Assignment
ufLang supports the following binary assignment operators:
Operator
Name
Description
Example
=
Assignment
Assigns the value of the right operand to the left operand.
x = 5
+=
Add and Assign
Adds the right operand to the left operand and assigns the result to the left operand.
x += 3
x = x + 3
-=
Subtract and Assign
Subtracts the right operand from the left operand and assigns the result to the left operand.
x -= 2
x = x - 2
*=
Multiply and Assign
Multiplies the left operand by the right operand and assigns the result to the left operand.
x *= 4
x = x * 4
/=
Divide and Assign
Divides the left operand by the right operand and assigns the result to the left operand.
x /= 2
x = x / 2
%=
Modulo and Assign
Applies the modulo operation to the left operand with the right operand and assigns the result to the left operand.
x %= 3
x = x % 3
⚠️ The result will be a Float
or Double
if one or more operands are of the same type; otherwise, it will retain the base type. ⚠️
Last updated