Project

General

Profile

Actions

Var » History » Revision 3

« Previous | Revision 3/21 (diff) | Next »
Per Amundsen, 02/28/2014 01:03 PM


Added in 1.8.8

/var [-sg] <%var> [[= ]value]

Sets the value of local variable %var to the specified value.

Switches

-s - Display variable assignment value.
-g - Creates a global variable instead.

Parameters

<%var> - The variable to set.
= ]value] - Value to set the variable to. (can be a single arithmetic expression, see [[Arithmetic Operators)

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 10 years ago · 3 revisions

Also available in: PDF HTML TXT