User Tools

Site Tools


at:tutorial:basic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:basic [2007/04/05 09:57] elisagat:tutorial:basic [2007/04/05 09:59] elisag
Line 78: Line 78:
 <code> <code>
 >def counter := 0 >def counter := 0
->> 0+>>0
 > def inc() { counter := counter + 1} > def inc() { counter := counter + 1}
 >><closure:inc> >><closure:inc>
-> inc()+>inc()
 >>1 >>1
 </code> </code>
Line 98: Line 98:
 </code> </code>
  
-Variables and functions defined locally to functions are only visible in the scope of the function where there were defined.  In the previous example, //fac// uses a local function //inner// that is only visible inside "facand its nested scopes, in the example //fac.inner.//+Variables and functions defined locally to functions are only visible in the scope of the function where there were defined.  In the previous example, //fac// uses a local function //inner// that is only visible inside //fac// and its nested scopes, in the example //fac.inner.//
    
 === Variable-Length Argument Functions === === Variable-Length Argument Functions ===
Line 113: Line 113:
 </code> </code>
  
-When the //sum// function is called, the arguments are passed to the function in a table called "argswhich can also be modified inside the body of the function. An alternative definition of the function sum follows:+When the //sum// function is called, the arguments are passed to the function in a table called //args// which can also be modified inside the body of the function. An alternative definition of the //sum// function follows:
 <code> <code>
 >def sum(a, b, @rest){ {  >def sum(a, b, @rest){ { 
at/tutorial/basic.txt · Last modified: 2020/02/09 22:05 by elisag