\c;%\n; remainder of the division (only for the type \c;\l;int\u cbot\int;\n;)
With the addition operator \c;+\n;, you can not only add numbers, you can also append \l;strings\u cbot\string;.
\c;
\s; int i = 12+3; // returns 15
\s; string s = "a"+"bc"; // returns "abc"
\s; int i = 2-5; // returns -3
\s; float f = 3.01*10; // returns 30.1
\s; int i = 5/3; // returns 1
\s; float f = 5/3; // returns 1.67
\s; float f = 5/0; // returns an error
\s; int i = 13%5; // returns 3
\s; int i = -8%3; // returns -2
\n;
An expression can include constants or \l;variables\u cbot\var;. For example:
\s;\c; 12+dist\n;
Multiplications and divisions are performed before additions and subtractions. In order to be sure that the operations are performed in the right order, use brackets:
\c;
\s; 12*a+b/c \n;is equivalent to\c; (12*a)+(b/c)
\s; 2.5*(dist+range)
\n;
In order to improve readability, you can put as many spaces as you want:
\c;
\s; 12*a + b/c
\s; 2.5 * (dist+range)
\n;
Here is a list of mathematical functions:
\c;sin(angle) \n;sinus
\c;cos(angle) \n;cosinus
\c;tan(angle) \n;tangent
\c;asin(value) \n;arc-sinus
\c;acos(value) \n;arc-cosinus
\c;atan(value) \n;arc-tangente
\c;sqrt(value) \n;square root
\c;pow(x, y) \n;x power y
\c;rand() \n;random value ranging between 0 and 1
Angles are indicated in degrees.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.