[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nested functions?
From: |
Vic Norton |
Subject: |
nested functions? |
Date: |
Tue, 18 Feb 2014 12:50:26 -0500 |
According to <http://www.gnu.org/software/octave/NEWS-3.8.html>
Octave now supports nested functions with scoping rules that are
compatible with Matlab.
Why then does
1;
function outerfunc()
global printhello = 1;
nested1();
function nested1()
global printhello;
if printhello
printf("hello world\n");
else
printf("goodbye world\n");
endif
endfunction
endfunction
outerfunc();
produce the error message
octave-cli-3.8.0> test2
parse error near line 11 of file
/Users/vic/Norton/Programming/octave/m/tests/test2.m
nested functions not implemented in this context
>>> function nested1()
^
when
1;
function outerfunc()
global printhello = 1;
nested1();
endfunction
function nested1()
global printhello;
if printhello
printf("hello world\n");
else
printf("goodbye world\n");
endif
endfunction
outerfunc();
produces
octave-cli-3.8.0> test3
hello world
- nested functions?,
Vic Norton <=
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Benjamin Abbott, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, fork, 2014/02/19
- Re: nested functions?, c., 2014/02/19
- Re: nested functions?, Vic Norton, 2014/02/20
- Re: nested functions?, c., 2014/02/20