[dismiss]
This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.
Difference between revisions of "If"
Jump to navigation
Jump to search
m
→Combining Comparisons: who said parantheses don't work?
imported>Gblues (added info about logical operators being unaffected by parenthesis) |
imported>JOG m (→Combining Comparisons: who said parantheses don't work?) |
||
Line 66: | Line 66: | ||
|} | |} | ||
Note that "||" is evaluated before "&&", just like "*" is evaluated before "+". in normal algebra. | |||
If you want the && to be evaluated first, you have to include that part in parentheses. For example: | |||
<nowiki>if myVar1 == 1 && myVar2 == 1 || myVar2 == 5</nowiki> | |||
This is true when MyVar1 = 1 AND myVar2 is either 1 or 5. | |||
<nowiki>if (myVar1 == 1 && myVar2 == 1) || myVar2 == 5</nowiki> | |||
This is true when either myVar2 is 5 OR both, myVar1 and myVar2 are 1 | |||
== Comparisons and Expressions == | == Comparisons and Expressions == |