Order of Precedence: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Lou Montana (talk | contribs) m (Add Columns template usage) |
||
Line 28: | Line 28: | ||
Unary operators (commands with 1 argument): | Unary operators (commands with 1 argument): | ||
* <tt>commandName</tt> a | * <tt>commandName</tt> a | ||
| | | {{Columns|2| | ||
* [[+ |+a]] | * [[+ |+a]] | ||
* [[- | -a]] | * [[- | -a]] | ||
Line 35: | Line 34: | ||
* [[!_a | !b]] | * [[!_a | !b]] | ||
* [[not | not b]] | * [[not | not b]] | ||
}} | |||
|- | |- | ||
| style="text-align: center" | 9 | | style="text-align: center" | 9 | ||
Line 52: | Line 51: | ||
* [[atan2]] | * [[atan2]] | ||
* [[Config]] access ([[config / name|/]]) | * [[Config]] access ([[config / name|/]]) | ||
| | | {{Columns|2| | ||
* [[a * b]] | * [[a * b]] | ||
* [[a / b]] | * [[a / b]] | ||
Line 60: | Line 58: | ||
* [[config / name]] | * [[config / name]] | ||
* [[atan2| a atan2 b]] | * [[atan2| a atan2 b]] | ||
}} | |||
|- | |- | ||
| style="text-align: center" | 6 | | style="text-align: center" | 6 | ||
Line 68: | Line 66: | ||
* [[String]] addition | * [[String]] addition | ||
* [[min]] and [[max]] commands | * [[min]] and [[max]] commands | ||
| | | {{Columns|2| | ||
* [[+ | a + b]] | * [[+ | a + b]] | ||
* [[- | a - b]] | * [[- | a - b]] | ||
Line 77: | Line 74: | ||
* [[min | a min b]] | * [[min | a min b]] | ||
* [[max | a max b]] | * [[max | a max b]] | ||
}} | |||
|- | |- | ||
| style="text-align: center" | 5 | | style="text-align: center" | 5 | ||
Line 98: | Line 95: | ||
* [[Config]] access ([[config greater greater name|>>]]) | * [[Config]] access ([[config greater greater name|>>]]) | ||
| | | | ||
{{Columns|2| | |||
* [[a == b]] | * [[a == b]] | ||
* [[a != b]] | * [[a != b]] | ||
Line 105: | Line 102: | ||
* [[a_greater=_b| a >= b]] | * [[a_greater=_b| a >= b]] | ||
* [[a_less=_b| a <= b]] | * [[a_less=_b| a <= b]] | ||
}} | |||
* [[config_greater_greater_name | config >> name]] | * [[config_greater_greater_name | config >> name]] | ||
|- | |- |
Revision as of 17:12, 14 June 2021
Introduction
Order of operations, also called operator precedence, is a set of rules specifying which procedures should be performed first in a mathematical expression.
Precedence Overview
Precedence | Type of Operator | Examples |
---|---|---|
11 |
Nular operators (commands with no arguments):
|
|
10 |
Unary operators (commands with 1 argument):
|
|
9 | Hash-select operator | |
8 | Power operator | |
7 | ||
6 | ||
5 | N/A | |
4 |
Binary operators (commands with 2 arguments):
|
|
3 | ||
2 | Logical and operator | |
1 | Logical or operator |
Examples
Input | Process | Comment |
---|---|---|
1 + 2 * 3 |
1 + (2 * 3) |
result equals 7, and not 9 (see also PEMDAS) |
sleep 10 + random 20 |
(sleep 10) + random 20 |
sleep 10 will return Nothing, then + random 20 will be calculated but not used. |