next up previous
Next: Optimization Up: Introduction to SCILAB Previous: Linear algebra

On line definition of function

Function may be defined in files using a text editor. It also possible to create if ``on line''.
-->deff('[x]=fact(n)',[
-->             'if n==0 then'
-->             '   x=1'
-->             'else' 
-->             '   x=n*fact(n-1)'
-->             'end'])

-->10+fact(5)
 ans  =
    130.


Scilab group