% demo6 function
function y2 = demo6 (x)
   disp (['in demo6'])
   x  %display x at call
   x = x +2;
   x   %display local x after incrementation
   
   demo3 (x)  %call to demo3
   disp (['in demo6 after return from demo3 x,w ='])
   [x w]
   demo5(x)
   
   %
      %demo3 is a nested function of demo4
      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;  %assigns to variable of primary fn
         ww = 55;  %local to demo3
      end   %required
  %
      %demo5 is another nested function of demo4
      function y5=demo5(z)
        disp (['in demo5, value of w,ww = '])
        w
        ww
      end  %required
end   %the end is required here also
