[Scilab-users] Nested function definition
Rafael Guerra
jrafaelbguerra at hotmail.com
Wed Apr 10 16:42:36 CEST 2019
I think the simple examples serve to show the syntax only, and do not explain its utility.
The nested function definition will be useful if called many times within a lengthy function, or just for sake of code clarity.
Regards,
Rafael
-----Original Message-----
From: users <users-bounces at lists.scilab.org> On Behalf Of Izabela Wójcik-Grzaba
Sent: Wednesday, April 10, 2019 5:04 PM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: Re: [Scilab-users] Nested function definition
Ok, so why nested function in help is so complicated:
//nested functions definition
function y=foo(x)
a=sin(x)
function y=sq(x), y=x^2,endfunction
y=sq(a)+1
endfunction
foo(%pi/3)
Couldn't it be formulated like below:
function y1=foo1(x)
a=sin(x);
y1=a^2+1;
endfunction
foo1(%pi/3)
That's why I had problems with my functions and couldn't understand why it has to be so complicated.
Thank you once more.
Iza
More information about the users
mailing list