view test/fcn-handle/bug60845.m @ 33589:f07a7fe7bd51 default tip @

maint: merge stable to default
author Rik <rik@octave.org>
date Thu, 16 May 2024 08:32:01 -0700
parents 6d1224698acf
children
line wrap: on
line source

function output = bug60845 (varargin)
  ## ahandle is a boolean variable
  [Ahandle, static, fcn_handle] = checkInput (varargin{:});

  ## execute nested function using handle
  output = fcn_handle ();

  function [Ahandle, static, fcn_handle] = checkInput (varargin)
    ## initialize
    Ahandle = true;
    static = false;
    ## get a handle to nested (sibling) function.
    fcn_handle = @nestfcn;
  endfunction

  function r = nestfcn ()
    if (islogical (Ahandle))
      r = true;
    else
      r = false;
    end
  endfunction
endfunction