Set number

Purpose: Set value of a number variable.

 set-number <variable> [ = <number> ]  [ process-scope ]

Number variable <variable> is either assigned value <number> with "=" clause, or it is assigned 0 if equal clause ("=") is omitted. A number is a signed 64-bit integer betwen LLONG_MIN+1 and LLONG_MAX-1 inclusive (i.e. between -9,223,372,036,854,775,807 and 9,223,372,036,854,775,806)

If "process-scope" clause is used, then number is of process scope, meaning its value will persist from one request to another for the life of the proces; in the statement where <variable> is created, the assignment will take place only once. This clause can only be used if <variable> did not already exist.

Note that <number> can also be a string character produced by using "[" and "]" to specify the index within a string (with 0 being the first character), as in:
 set-string my_str = "Some string"
 set-number my_num = my_str[2]

In the above example, "my_num" will be 109, which is the integer representation of character 'm'.
Examples
Initialize number "my_num" to 0 and the value of this variable, however it changes, will persist through any number of requests in the same process:
 set-number my_num process-scope

Initialize number "my_num" to 10:
 set-number my_num = 10

Subtract 5:
 set-number my_num = my_num-5

Assign an expression:
 set-number my_num = (some_num*3+1)%5



Copyright (c) 2019-2025 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.