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/17 16:24] – * tvcutsem | at:tutorial:basic [2007/04/17 16:43] – tvcutsem | ||
---|---|---|---|
Line 4: | Line 4: | ||
====== Functional and Imperative Programming ====== | ====== Functional and Imperative Programming ====== | ||
- | This part of the tutorial | + | This part of the tutorial |
===== Variables ===== | ===== Variables ===== | ||
- | As usual, one can define, assign and refer to a variable. Variable definitions are made with the keyword **def**. Note that AmbientTalk is a dynamically typed language so, variables do not have a type but, they just contain | + | As usual, one can define, assign and refer to a variable. Variable definitions are made with the keyword **def**. Note that AmbientTalk is a dynamically typed language, so variables do not have a type but can contain |
- | In the examples we use the interactive AmbientTalk shell (iat) where the input and output prompt are represented by > and >> | + | In the examples we use the interactive AmbientTalk shell (iat) where the input and output prompt are represented by > and %%>>%% respectively. |
< | < | ||
Line 19: | Line 19: | ||
</ | </ | ||
- | Variable definitions can be combined with assignments as shown above. As in Pico, assignments uses the ": | + | Variable definitions can include an initialization expression that immediately initializes the variable. Variable assignment is performed by means of the well-known |
- | An assignment consists of one or more expressions, | ||
< | < | ||
>[x, y] := [ y, x ] | >[x, y] := [ y, x ] | ||
>> | >> | ||
</ | </ | ||
+ | |||
+ | As we will explain later, the '' | ||
The variable name is used to refer a variable. The variable is evaluated when referenced. | The variable name is used to refer a variable. The variable is evaluated when referenced. | ||
Line 32: | Line 33: | ||
>>7 | >>7 | ||
</ | </ | ||
+ | |||
+ | < | ||
+ | When using the '': | ||
+ | </ | ||
===== Tables ===== | ===== Tables ===== |
at/tutorial/basic.txt · Last modified: 2020/02/09 22:05 by elisag