Difference between revisions of "Not"

From MultiCharts
Jump to navigation Jump to search
m (Reverted edits by 176.8.90.7 (talk) to last revision by 194.84.116.138)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Used in True/False statements: '''negative'''
+
Not is used in True/False statements, and makes an expression '''opposite''' to another expression. For example, if condition A equals [[True]], then Not A would equal [[False]]. If condition B is False, then Not B would be True.
  
==== Example ====
+
== Usage ==
 +
<syntaxhighlight>not</syntaxhighlight>
 +
 
 +
== Examples ==
 
<syntaxhighlight>Condition1 = True;  
 
<syntaxhighlight>Condition1 = True;  
  
Condition2 = Not Condition1;  
+
Condition2 = Not Condition1;</syntaxhighlight>
 +
Assigns to Condition2 value opposite to Condition1.
 +
 
 +
Another example would be:
 +
<syntaxhighlight>
 +
condition1 = 10 > 1;
 +
condition2 = not condition1;
 +
 
 +
Print("10 > 1 is ",condition1, spaces(5), "Not 10 > 1 is ", condition2);
 +
</syntaxhighlight>
 +
Which gives the following output in the PowerLanguage Editor log:
 +
<syntaxhighlight>
 +
10 > 1 is TRUE    Not 10 > 1 is FALSE
 +
</syntaxhighlight>
 +
 
 +
'''Not''' can also be used to revert a False condition, as is done in the example below:
 +
<syntaxhighlight>
 +
condition1 = 10 > 100;
 +
condition2 = not condition1;
  
Assigns to Condition2 value opposite to Condition1</syntaxhighlight>
+
Print("10 > 100 is ",condition1, spaces(5), "Not 10 > 100 is ", condition2);
 +
</syntaxhighlight>
 +
Which gives the following:
 +
<syntaxhighlight>
 +
10 > 100 is FALSE    Not 10 > 100 is TRUE
 +
</syntaxhighlight>
  
 
[[Category:Comparisons and Loops]]
 
[[Category:Comparisons and Loops]]

Latest revision as of 10:45, 19 February 2012

Not is used in True/False statements, and makes an expression opposite to another expression. For example, if condition A equals True, then Not A would equal False. If condition B is False, then Not B would be True.

Usage

not

Examples

Condition1 = True; 

Condition2 = Not Condition1;

Assigns to Condition2 value opposite to Condition1.

Another example would be:

condition1 = 10 > 1;
condition2 = not condition1;

Print("10 > 1 is ",condition1, spaces(5), "Not 10 > 1 is ", condition2);

Which gives the following output in the PowerLanguage Editor log:

10 > 1 is TRUE     Not 10 > 1 is FALSE

Not can also be used to revert a False condition, as is done in the example below:

condition1 = 10 > 100;
condition2 = not condition1;

Print("10 > 100 is ",condition1, spaces(5), "Not 10 > 100 is ", condition2);

Which gives the following:

10 > 100 is FALSE     Not 10 > 100 is TRUE