Not: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(edit)
(edit)
Line 1: Line 1:
#Redirect:[[~]]
The logical [[Unary operators|unary]] negation operator '''~''' reverses the meaning of its operand. The operand must be numeric. '''Note that in BR, 1 means true and 0 means false'''.
 
The '''~''' operator works as follows:
* The result is true if the converted operand is false
* The result is false if the converted operand is true.
 
The '''~''' operator is equivalent to the '''NOT''' operator, with one difference: ~ works everywhere whereas NOT will only work in If and PRINT statements
 
'''~''' is usually used in conjunction with an [[If]] [[statement]].
 
<noinclude>
[[Category:Operators]]
[[Category:Logical Operators]]
</noinclude>

Revision as of 14:32, 9 January 2012

The logical unary negation operator ~ reverses the meaning of its operand. The operand must be numeric. Note that in BR, 1 means true and 0 means false.

The ~ operator works as follows:

  • The result is true if the converted operand is false
  • The result is false if the converted operand is true.

The ~ operator is equivalent to the NOT operator, with one difference: ~ works everywhere whereas NOT will only work in If and PRINT statements

~ is usually used in conjunction with an If statement.