Arithmetical And Logical Operations
Operator
|
Operand/
Data Type
|
Results In Data Type
|
Description
|
++, --
|
int
|
int
|
Adds/subtracts 1 to/from the value of the operand. Superior expressions are evaluated before the value of the operand is changed.
|
+
|
int, float, bool, string
|
Depends on operand data types. It will be converted into the more precise data type.
|
Calculates the sum of the two operands or concatenates two character strings.
|
-, *, /
|
int, float, bool
|
Depends on operand data types. It will be converted into the more precise data type.
|
Calculates the difference/product/quotient of the two operands.
|
%
|
int
|
int
|
Calculates the remainder of an integer division.
|
<, <=, >, >=, ==, !=
|
int, float, bool, string
|
bool
|
Compares two operands.
|
!
|
bool
|
bool
|
This is the logical NOT. It negates the following operand.
|
||
|
bool
|
bool
|
This is the logical OR. The result is true, if at least one operand is true. Both operands are evaluated in every single case.
|
&&
|
bool
|
bool
|
This is the logical AND. The result is true, if both operands are true. Both operands are evaluated in every single case.
|
Assignment Operations
Operator
|
Description
|
=
|
A simple assignment. The left operand gets the value of the right one.
|
+=
|
For example: i += 4 corresponds to i = i + 4.
|
-=
|
For example: i -= 4 corresponds to i = i - 4.
|
*=
|
For example: i *= 4 corresponds to i = i * 4.
|
/=
|
For example: i /= 4 corresponds to i = i / 4.
|
%=
|
For example: i %= 4 corresponds to i = i % 4.
|
|