Scroll to navigation

GOLF(2gg) Development GOLF(2gg)

NAME

set-number - (numbers)

PURPOSE

Set value of a number variable.

SYNTAX

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

DESCRIPTION

Number variable <var> is either assigned value <number> with "=" clause, or it is assigned 0 if equal clause ("=") is omitted.

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 process.

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

SEE ALSO


Numbers

abs-number number-expressions number-string set-number string-number See all documentation

$VERSION $DATE