at:tutorial:basic
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
at:tutorial:basic [2007/04/05 09:57] – elisag | at:tutorial:basic [2007/04/05 10:01] – elisag | ||
---|---|---|---|
Line 29: | Line 29: | ||
Reference is just done by evaluating the variable. | Reference is just done by evaluating the variable. | ||
- | ==== Tables ==== | + | ===== Tables |
As in Pico, indexed tables represent what other languages call arrays or lists. Tables are unidimensional and their indexes range from 1 to the size of the table. As variables, one can define, assign and refer to a table. Table definition is also made with the keyword **def** in the following form: | As in Pico, indexed tables represent what other languages call arrays or lists. Tables are unidimensional and their indexes range from 1 to the size of the table. As variables, one can define, assign and refer to a table. Table definition is also made with the keyword **def** in the following form: | ||
Line 59: | Line 59: | ||
>>[1, [1, 2, [" | >>[1, [1, 2, [" | ||
</ | </ | ||
+ | |||
+ | === Table Splicing === | ||
+ | |||
+ | TODO! | ||
==== Functions ==== | ==== Functions ==== | ||
Line 78: | Line 82: | ||
< | < | ||
>def counter := 0 | >def counter := 0 | ||
- | >> 0 | + | >>0 |
> def inc() { counter := counter + 1} | > def inc() { counter := counter + 1} | ||
>>< | >>< | ||
- | > inc() | + | >inc() |
>>1 | >>1 | ||
</ | </ | ||
Line 98: | Line 102: | ||
</ | </ | ||
- | Variables and functions defined locally to functions are only visible in the scope of the function where there were defined. | + | Variables and functions defined locally to functions are only visible in the scope of the function where there were defined. |
=== Variable-Length Argument Functions === | === Variable-Length Argument Functions === | ||
Line 113: | Line 117: | ||
</ | </ | ||
- | When the //sum// function is called, the arguments are passed to the function in a table called | + | When the //sum// function is called, the arguments are passed to the function in a table called |
< | < | ||
>def sum(a, b, @rest){ { | >def sum(a, b, @rest){ { |
at/tutorial/basic.txt · Last modified: 2020/02/09 22:05 by elisag