Arithmetical Operators
+ (Add)
This operator is used to add numerical values or bind strings together.
result = Expression1 + Expression2
Following example addiert different values:
dim x as integer x = 1+2+3
Following example binds different strings together:
dim a as string a = "i am "+" a "+" string" a = a + " - 123"
- (Sub)
This operator is used to subtract two values.
Result = Expression1 - Expression2
This example does subtract different values:
dim x as integer x = 10-2-4
* (Asterix)
This operator is used to multipy two values.
Result = Expression1 * Expression2
This example does multiply different values:
dim x as integer x = 1*2*3
/ (Slash)
This operator is used to divide two values.
Result = Expression1 / Expression2
This example does divide different values:
dim x as integer x = 9 / 3
^ (Circumflex/Hat)
This operator is used to potentiate a value.
Result = Expression1 ^ Expression2
This example does potentiate a value with 2:
ATTENTION! This function is processed in floatingh point arithmetic, like the function pow() in C. Integer arguments are automatically converted.
dim x as single x = 1.234 ^ 2
MOD
This operator performs a modulo operation of a value.
Result = Expression1 MOD Expression2
The MOD-operator works with integers (Values without decimal places). Floating-point values would reduced to integers. Is one of the two arguments of the value = 0, then the result is undefined.
dim x as integer x = 5 mod 2 ' Result: 1 x = 5 mod 1.999 ' Result: 0