Var » History » Version 2
Per Amundsen, 02/28/2014 01:02 PM
1 | 1 | Per Amundsen | _Added in 1.8.8_ |
---|---|---|---|
2 | |||
3 | */var [-sg] <%var> [[= ]value]* |
||
4 | |||
5 | Sets the value of local variable %var to the specified value. |
||
6 | |||
7 | *Switches* |
||
8 | |||
9 | -s - Display variable assignment value. |
||
10 | -g - Creates a global variable instead. |
||
11 | |||
12 | *Parameters* |
||
13 | |||
14 | <%var> - The variable to set. |
||
15 | [[= ]value] - Value to set the variable to. (can be a single arithmetic expression, see [[Arithmetic Operators]]) |
||
16 | |||
17 | *Example* |
||
18 | |||
19 | 2 | Per Amundsen | <pre> |
20 | 1 | Per Amundsen | alias example { |
21 | var %result = 1, %x = $1 |
||
22 | while (%x) { |
||
23 | var %result = %result * $v1 |
||
24 | dec %x |
||
25 | } |
||
26 | return %result |
||
27 | } |
||
28 | 2 | Per Amundsen | </pre> |