pub enum BinOp {
Show 16 variants
Add,
Sub,
Div,
Mul,
Power,
Mod,
IsEqual,
NotEqual,
GreaterThan,
LessThan,
LessThanOrEqual,
GreaterThanOrEqual,
PlusAssign,
SubtractAssign,
Or,
And,
}
Expand description
A binary operation type. Having a seperate enum for this avoids repitition and allows for some optimisations downstream.
Variants§
Add
Addition. Example: 10+14
is 24
Sub
Subtraction. Example: 5-3
is 2
Div
Division. Example: 32/4
is 8
Mul
Multiplication. Example: 5*11
is 55
Power
Power of. Example: (3^3
or 3**3
) is 81
Mod
Modulo. Example: 20 % 2
is 0
IsEqual
Equals to. Example: 20 == 2
is false
NotEqual
Not equals to. Example: 20 == 2
is true
. This is the opposite of
BinOp::IsEqual
GreaterThan
Greater than operator. Example: 5 > 6
is false
.
LessThan
Less than operator. Example: 5 < 6
is true
.
LessThanOrEqual
Similar to BinOp::LessThan and BinOp::IsEqual combined. If it is
less than x
OR equal to x
.
GreaterThanOrEqual
Similar to BinOp::GreaterThan and BinOp::IsEqual combined. If it is
greater than x
OR equal to x
.
PlusAssign
Increment x by y. Take this syntax for example: x += y
.
SubtractAssign
Decrement x by y. Take this syntax for example: x += y
.
Or
An or
/ ||
operator for checking expressions that have to include 1
or more as true
(similar to how BinOp::IsEqual works).
And
An and
/ &&
operator for checking expressions that have to include
all as true
.