% demo4 function
function y2 = demo4 (x)
   disp (['in demo4'])
   x  %display x at call
   x = x +2;
   x   %display local x after incrementation
   
   demo3 (x)  %call to demo3
   disp (['in demo4 after return from demo3 x,w='])
   [x w]
      %demo3 is a nested function of demo2
      function y3 = demo3(y)
      disp (['in demo3 before increment'])
      y
      y = y +3;  %increment
      disp (['in demo3 after increment'])
      y
      disp (['in demo3 nonlocal x = '])
      x
      w=33;
      end   %required
end   %the end is required here also
