Operators: Difference between revisions
From MoodleDocs
(Created page with "==Operators== The following operators, available in the Formulas question type, are JavaScript operators. For more details, see for example [http://www.w3schools.com/jsref/js...") |
|||
Line 1: | Line 1: | ||
[https://docs.moodle.org/33/en/Formulas_question_type < Formulas question type] | |||
==Operators== | ==Operators== | ||
Line 92: | Line 94: | ||
| right shift | | right shift | ||
|} | |} | ||
[https://docs.moodle.org/33/en/Formulas_question_type < Formulas question type] |
Revision as of 21:05, 27 October 2017
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 |