# Difference between revisions of "Order Of Operations"

From ROBOTC API Guide

(→Operations level 1) |
|||

Line 20: | Line 20: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | ++ | ++x | a unary operator that increases the value of "x" by one | + | | ++ || ++x || a unary operator that increases the value of "x" by one |

|- | |- | ||

− | | -- | --x | A unary operator that decreases the value of "x" by one | + | | -- || --x || A unary operator that decreases the value of "x" by one |

|- | |- | ||

− | | + | +x | A unary operator that does ???????? | + | | + || +x || A unary operator that does ???????? |

|- | |- | ||

− | | - | -x | A unary operator that does ???????? | + | | - || -x || A unary operator that does ???????? |

|- | |- | ||

− | | ! | !x | A logical operator that returns a boolean value that is the opposite of "x" (If "x" is true, then "!x" returns false) | + | | ! || !x || A logical operator that returns a boolean value that is the opposite of "x" (If "x" is true, then "!x" returns false) |

|- | |- | ||

|} | |} | ||

Line 36: | Line 36: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | / | a / b | An operator that returns the value of "a divided by b" | + | | / || a / b || An operator that returns the value of "a divided by b" |

|- | |- | ||

− | | * | a * b | An operator that returns the value of "a multipleid by b" | + | | * || a * b || An operator that returns the value of "a multipleid by b" |

|- | |- | ||

− | | % | a % b | An operator that returns the value of "the reamainder of a divided by b" | + | | % || a % b || An operator that returns the value of "the reamainder of a divided by b" |

|- | |- | ||

|} | |} | ||

Line 48: | Line 48: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | + | a + b | An operator that returns the value of "a plus b" | + | | + || a + b || An operator that returns the value of "a plus b" |

|- | |- | ||

− | | - | a - b | An operator that returns the value of "a minus b" | + | | - || a - b || An operator that returns the value of "a minus b" |

|- | |- | ||

|} | |} | ||

Line 58: | Line 58: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | / | a / b | An operator that returns the value of "a divided by b" | + | | / || a / b || An operator that returns the value of "a divided by b" |

|- | |- | ||

− | | * | a * b | An operator that returns the value of "a multipleid by b" | + | | * || a * b || An operator that returns the value of "a multipleid by b" |

|- | |- | ||

− | | % | a % b | An operator that returns the value of "the reamainder of a divided by b" | + | | % || a % b || An operator that returns the value of "the reamainder of a divided by b" |

|- | |- | ||

|} | |} | ||

Line 70: | Line 70: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | >> | a >> b | A bitwise shift to the right ????????? | + | | >> || a >> b || A bitwise shift to the right ????????? |

|- | |- | ||

− | | << | a << b | A bitwise shift to the left ?????????? | + | | << || a << b || A bitwise shift to the left ?????????? |

|- | |- | ||

|} | |} | ||

Line 82: | Line 82: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | < | a < b | A logical statement that returns "true" if a is less than b | + | | < || a < b || A logical statement that returns "true" if a is less than b |

|- | |- | ||

− | | * | a <= b |A logical statement that returns "true" if a is less than or equal to b | + | | * || a <= b || A logical statement that returns "true" if a is less than or equal to b |

|- | |- | ||

− | | > | a > b | A logical statement that returns "true" if a is greater than b | + | | > || a > b || A logical statement that returns "true" if a is greater than b |

|- | |- | ||

− | | >= | a >= b | A logical statement that returns "true" if a is greater than or equal to b | + | | >= || a >= b || A logical statement that returns "true" if a is greater than or equal to b |

|- | |- | ||

|} | |} | ||

Line 98: | Line 98: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | = | a = b |A logical statement that returns "true" if a is equal to b | + | | = || a = b || A logical statement that returns "true" if a is equal to b |

|- | |- | ||

− | | != | a != b | A logical statement that returns "true" if a NOT equal to b | + | | != || a != b || A logical statement that returns "true" if a NOT equal to b |

|- | |- | ||

|} | |} | ||

Line 108: | Line 108: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | & | a & b | A bitwise operator AND ???????? | + | | & || a & b || A bitwise operator AND ???????? |

|- | |- | ||

|} | |} | ||

Line 116: | Line 116: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | | + | | ^ || a ^ b || A bitwise operator ExclusiveOR ???????? |

|- | |- | ||

|} | |} | ||

Line 124: | Line 124: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | | + | | | || a | b || A bitwise operator OR ???????? |

|- | |- | ||

|} | |} | ||

Line 132: | Line 132: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | && | | + | | && || a && b || Returns "true" if both "a" and "b" are also true |

|- | |- | ||

|} | |} | ||

Line 140: | Line 140: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | <code> || </code> | <code> a || b </code> | Returns "true" if either "a" or "b" is true | + | | <code> || </code> || <code> a || b </code> || Returns "true" if either "a" or "b" is true |

|- | |- | ||

|} | |} | ||

Line 148: | Line 148: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | ?: | a ? b : c | Ternary operations [[Tertiary_operators]] | + | | ?: || a ? b : c || Ternary operations [[Tertiary_operators]] |

|- | |- | ||

|} | |} | ||

Line 156: | Line 156: | ||

{|class="wikitable" | {|class="wikitable" | ||

|- | |- | ||

− | ! Operator ! Syntax ! Explaination | + | ! Operator !! Syntax !! Explaination |

|- | |- | ||

− | | = | a = b | Assigns the value of "b" to "a" | + | | = || a = b || Assigns the value of "b" to "a" |

|- | |- | ||

− | | += | a += b | Assigns the value of "a + b" to "a" | + | | += || a += b || Assigns the value of "a + b" to "a" |

|- | |- | ||

− | | -= | a -= b | Assigns the value of "a - b" to "a" | + | | -= || a -= b || Assigns the value of "a - b" to "a" |

|- | |- | ||

− | | /= | a /= b | Assigns the value of "a / b" to "a" | + | | /= || a /= b || Assigns the value of "a / b" to "a" |

|- | |- | ||

− | | *= | a *= b | Assigns the value of "a * b" to "a" | + | | *= || a *= b || Assigns the value of "a * b" to "a" |

|- | |- | ||

− | | %= | a %= b | Assigns the value of "a % b" to "a" | + | | %= || a %= b || Assigns the value of "a % b" to "a" |

− | + | ||

|- | |- | ||

− | | <<= | a <<b | Assigns the value of "b" to "a" | + | | <<= || a <<= b || Assigns the value of "a << b" to "a" |

|- | |- | ||

− | | >>= | a >>= b | Assigns the value of "a + b" to "a" | + | | >>= || a >>= b || Assigns the value of "a + b" to "a" |

|- | |- | ||

− | | &= | a &= b | Assigns the value of "a - b" to "a" | + | | &= || a &= b || Assigns the value of "a - b" to "a" |

|- | |- | ||

− | | ^= | a ^= b | Assigns the value of "a / b" to "a" | + | | ^= || a ^= b || Assigns the value of "a / b" to "a" |

|- | |- | ||

− | | |= | a |= b | Assigns the value of "a * b" to "a" | + | | |= | a |= b || Assigns the value of "a * b" to "a" |

|- | |- | ||

|} | |} |

## Revision as of 12:24, 9 August 2012

General Programming → Order Of Operations

**TODO:** There is no page for C Order of operations/Operators at all. So I made one, and it'd be nice if I could get a bit of help with it?

### Operations level 1

Operator | Syntax | Explanation |
---|---|---|

++ | x++ | a unary operator that increases the value of "x" by one |

-- | x-- | A unary operator that decreases the value of "x" by one |

### Operations Level 2

Operator | Syntax | Explaination |
---|---|---|

++ | ++x | a unary operator that increases the value of "x" by one |

-- | --x | A unary operator that decreases the value of "x" by one |

+ | +x | A unary operator that does ???????? |

- | -x | A unary operator that does ???????? |

! | !x | A logical operator that returns a boolean value that is the opposite of "x" (If "x" is true, then "!x" returns false) |

### Operations Level 3

Operator | Syntax | Explaination |
---|---|---|

/ | a / b | An operator that returns the value of "a divided by b" |

* | a * b | An operator that returns the value of "a multipleid by b" |

% | a % b | An operator that returns the value of "the reamainder of a divided by b" |

### Operations Level 4

Operator | Syntax | Explaination |
---|---|---|

+ | a + b | An operator that returns the value of "a plus b" |

- | a - b | An operator that returns the value of "a minus b" |

### Operations Level 5

Operator | Syntax | Explaination |
---|---|---|

/ | a / b | An operator that returns the value of "a divided by b" |

* | a * b | An operator that returns the value of "a multipleid by b" |

% | a % b | An operator that returns the value of "the reamainder of a divided by b" |

### Operations Level 6

Operator | Syntax | Explaination |
---|---|---|

>> | a >> b | A bitwise shift to the right ????????? |

<< | a << b | A bitwise shift to the left ?????????? |

### Operations Level 7

Also known as "boolean operators" for returning boolean values

Operator | Syntax | Explaination |
---|---|---|

< | a < b | A logical statement that returns "true" if a is less than b |

* | a <= b | A logical statement that returns "true" if a is less than or equal to b |

> | a > b | A logical statement that returns "true" if a is greater than b |

>= | a >= b | A logical statement that returns "true" if a is greater than or equal to b |

### Operations Level 8

Also known as "boolean operators" for returning boolean values

Operator | Syntax | Explaination |
---|---|---|

= | a = b | A logical statement that returns "true" if a is equal to b |

!= | a != b | A logical statement that returns "true" if a NOT equal to b |

### Operations Level 9

Operator | Syntax | Explaination |
---|---|---|

& | a & b | A bitwise operator AND ???????? |

### Operations Level 10

Operator | Syntax | Explaination |
---|---|---|

^ | a ^ b | A bitwise operator ExclusiveOR ???????? |

### Operations Level 11

Operator | Syntax | Explaination |
---|---|---|

b | A bitwise operator OR ???????? |

### Operations Level 12

Operator | Syntax | Explaination |
---|---|---|

&& | a && b | Returns "true" if both "a" and "b" are also true |

### Operations Level 13

Operator | Syntax | Explaination | ||
---|---|---|---|---|

` ` |
` a ` |
b | Returns "true" if either "a" or "b" is true |

### Operations Level 14

Operator | Syntax | Explaination |
---|---|---|

?: | a ? b : c | Ternary operations Tertiary_operators |

### Operations Level 15

Operator | Syntax | Explaination |
---|---|---|

= | a = b | Assigns the value of "b" to "a" |

+= | a += b | Assigns the value of "a + b" to "a" |

-= | a -= b | Assigns the value of "a - b" to "a" |

/= | a /= b | Assigns the value of "a / b" to "a" |

*= | a *= b | Assigns the value of "a * b" to "a" |

%= | a %= b | Assigns the value of "a % b" to "a" |

<<= | a <<= b | Assigns the value of "a << b" to "a" |

>>= | a >>= b | Assigns the value of "a + b" to "a" |

&= | a &= b | Assigns the value of "a - b" to "a" |

^= | a ^= b | Assigns the value of "a / b" to "a" |

= | a |= b | Assigns the value of "a * b" to "a" |