Var » History » Revision 12
« Previous |
Revision 12/21
(diff)
| Next »
Per Amundsen, 11/18/2018 03:04 AM
Added in 1.8.8
/var [-gnsp] <%var> [[= ]value]
Sets the value of local variable %var to the specified value.
Syntax can be either var %var = value or var %var value.
Multiple variables can be set in one line using comma as separator, var %var1 = value, %var2 = 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.
-p - TODO
Parameters
<%var> - The variable to set.
arithmetic expression)
Example
alias factorial { var %result = 1, %x = $1 while (%x) { var %result = %result * $v1 dec %x } return %result } ;Returns 3628800 //echo -ag $factorial(10)
Updated by Per Amundsen about 6 years ago · 12 revisions