# Set Command

We've talked about variables and arithmetic expressions a little bit already. There is no variable declaration in ObjectScript. You use Set to evaluate an arithmetic expression and assign the result to a variable. Variables can hold up to 32K characters, or with Long Strings enabled, 3.47M characters.

``````SAMPLES>set x = 4 + 2

SAMPLES>write x
6
SAMPLES>
``````

ObjectScript uses seven binary arithmetic operators. The first two are also unary operators.

Arithmetic Operators
Operator Operation Example (Results)
+ Addition. When used in front of an expression as a unary operator, it forces a numeric interpretation of the expression. set x = 4 + 2 (x=6) set z = "546-FRJ", y = +z (y=546)
- Subtraction. When used in front of an expression as a unary operator, it forces a numeric interpretation of the expression, and reverses the sign. set x = 4 - 2 (x=2) set z = "-5 degrees", y = -z (y=5)
* Multiplication. set x = 4 * 2 (x=8)
/ Division set x = 5 / 2 (x=2.5)
** Exponentiation. set x = 5 ** 2 (x=25)
\ Integer Division. This divides the first operand by the second and produces the integer portion of the result, without the fractional portion. set x = 5 \ 2 (x=2)
# Modulo. This divides the first operand by the second and produces the integer remainder of the result only. set x = 5 # 2 (x=1)
FeedbackOpens in a new tab