Var » History » Revision 6
Revision 5 (Per Amundsen, 06/27/2014 02:25 PM) → Revision 6/21 (Per Amundsen, 06/27/2014 02:25 PM)
_Added in 1.8.8_ */var [-sg] <%var> [[= ]value]* Sets the value of local variable %var to the specified value. Syntax can be either _var var %var = value_ value or _var var %var value_. value. Multiple variables can be set in one line using comma as seperator, _var var %var1 - value, var%2 = value2_. value2 *Switches* -s - Display variable assignment value. -g - Creates a global variable instead. -n - Treat the value as plain text, even if arithmetic operators are used. *Parameters* <%var> - The variable to set. [[= ]value] - Value to set the variable to. (can be a single arithmetic expression, see [[Arithmetic Operators]]) *Example* <pre> alias factorial { var %result = 1, %x = $1 while (%x) { var %result = %result * $v1 dec %x } return %result } ;Returns 3628800 //echo -ag $factorial(10) </pre>