Operators
From MoodleDocs
Operators
The following operators, available in the Formulas question type, are JavaScript operators. For more details, see for example w3schools/jsref/jsref_operators.
Operator | Definition |
---|---|
Arithmetic Operators | |
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
% | modulus (division remainder) |
Assignment Operators | |
= | assigns a value to a variable |
Comparison Operators | |
== | equal to |
!= | not equal |
> | greater than |
< | less than |
>= | greater than or equal to |
<= | less than or equal to |
Conditional (Ternary) Operator | |
? : | conditional operator |
Logical Operators | |
&& | and |
| | or |
! | not |
Bitwise Operators | |
& | AND |
| | OR |
~ | NOT |
^ | XOR (Note that ^ means "power" in algebraic formulas) |
<< | left shift |
>> | right shift |