view test/nest/no_closure.m @ 28202:6c88000fed48 stable

add test files accidentally omitted from previous change 7567413e7246 * test/nest/script_nest_2.m, test/nest/script_nest_script_2.m: New files.
author John W. Eaton <jwe@octave.org>
date Sat, 11 Apr 2020 08:19:45 -0400
parents 287b07229aff
children fc4bb4bd1d5e
line wrap: on
line source

# no_closure.m
function r = no_closure (n)
  if (ischar (n))
    r = nested (n);
  else
    if (n == 0)
      r = @no_closure;
    elseif (n == 1)
      r = @nested;
    endif
  endif
  function r = nested (x)
    if (nargin == 1)
      r = ["nested ", x];
    else
      r = "nested";
    endif
  endfunction
endfunction