Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Operators.

Operators: Difference between revisions

From MoodleDocs
No edit summary
(Redirected page to Formulas: Operators)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
[https://docs.moodle.org/33/en/Formulas_question_type < Formulas question type]
#REDIRECT [[Formulas:_Operators]]
 
==Operators==
 
Numerical operators available in the Formulas question type are listed in the table below. They are equivalent to those corresponding in JavaScript. For more details on these operators, see for example [http://www.w3schools.com/jsref/jsref_operators.asp w3schools/jsref/jsref_operators].
 
{| class="nicetable"
|-
! Operator
! Definition
|-
| <b>Arithmetic Operators</b>
|
|-
| +
| addition
|-
| -
| subtraction
|-
| *
| multiplication
|-
| /
| division
|-
| %
| modulus (division remainder)
|-
| <b>Assignment Operators</b>
|
|-
| =
| assigns a value to a variable
|-
| <b>Comparison Operators</b>
|
|-
| ==
| equal to
|-
| !=
| not equal
|-
| &#62;
| greater than
|-
| &#60;
| less than
|-
| >=
| greater than or equal to
|-
| <=
| less than or equal to
|-
| <b>Conditional (Ternary) Operator</b>
|
|-
| ? :
| conditional operator
|-
| <b>Logical Operators</b>
|
|-
| &&
| and
|-
| | |
| or
|-
| !
| not
|-
| <b>Bitwise Operators</b>
|
|-
| &
| AND
|-
| &#124;
| OR
|-
| ~
| NOT
|-
| ^
| XOR<br>(Note that ^ means "power" in algebraic formulas)
|-
| <<
| left shift
|-
| >>
| right shift
|}
 
[https://docs.moodle.org/33/en/Formulas_question_type < Formulas question type]

Latest revision as of 01:42, 22 January 2018