Project

General

Profile

Actions

Var » History » Revision 16

« Previous | Revision 16/21 (diff) | Next »
Per Amundsen, 12/30/2018 11:45 PM


Added in 1.8.8

/var [-gnspB] <%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.

See also /set, /unset.

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.
-i - Initializes a variable only if it does not already exist as a local or global variable.
-p - Permits value to be 2 literal double quotes and permits value to end with a single $chr(32) space. Also enables -n switch behavior.
-B - Performs a $calcint calculation instead of regular $calc when arithmetic operators are used. (AdiIRC only)

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 over 5 years ago · 16 revisions

Also available in: PDF HTML TXT