On 10-Oct-2011, José Vallet wrote:
| Is it possible to define and use scripts within functions?
|
Currently in Octave, the script parts would have to go in separate
files and you can't pass any arguments to them.
In Matlab, nested functions work the way you want, but most of the
Octave developers think that is not good programming practice since
Matlab also lacks any sort of local variable declaration, so it makes
modifying code written this way risky. If your function has many
variables, then it becomes difficult to know whether a nested function
is supposed to be modifying variables in the calling function's scope,
and it is easy to accidentally make changes which have unintended
consequences by changing values in the parent function.