Unary operations: Difference between revisions
Jump to navigation
Jump to search
(edit) |
No edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
A unary operator is an operator which takes 1 argument, as opposed to a [[Binary | A '''unary operator''' is an [[operator]] which takes 1 argument, as opposed to a [[Binary operations|binary operations]], which take 2 arguments. All of the unary operators must have [[Numeric|numeric]] variables as their operand. | ||
Below is the list of unary operators: | Below is the list of unary operators: | ||
Line 15: | Line 15: | ||
|width="10%"|'''-'''||unary minus, returns the opposite of its operand | |width="10%"|'''-'''||unary minus, returns the opposite of its operand | ||
|} | |} | ||
<noinclude> | |||
[[Category:Operations]] | |||
</noinclude> |
Latest revision as of 13:59, 13 May 2014
A unary operator is an operator which takes 1 argument, as opposed to a binary operations, which take 2 arguments. All of the unary operators must have numeric variables as their operand.
Below is the list of unary operators:
Operator | Effect |
~ | negation operator, returns true if its operand is false, returns false if its operand is true |
not | same as ~ operator above |
+ | unary plus, returns its operand |
- | unary minus, returns the opposite of its operand |