Difference between revisions of "Statement Reference"
Jump to navigation
Jump to search
not having the conditional values in parenthesis caused undesirable results while testing my own codes
imported>Jlundin (Created page with "A statement is an arrangement of expressions used to perform work (and may just be a simple expression). There are also some more complicated statements ...") |
imported>Ditre (not having the conditional values in parenthesis caused undesirable results while testing my own codes) |
||
Line 71: | Line 71: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; If value is true, will set x to 1, otherwise it will do nothing | ; If value is true, will set x to 1, otherwise it will do nothing | ||
if value | if (value) | ||
x = 1 | x = 1 | ||
endIf | endIf | ||
Line 78: | Line 78: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; If myCoolValue is 20, will set x to 5, otherwise it will set it to 10 | ; If myCoolValue is 20, will set x to 5, otherwise it will set it to 10 | ||
if myCoolValue == 20 | if (myCoolValue == 20) | ||
x = 5 | x = 5 | ||
else | else | ||
Line 87: | Line 87: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; If the value is above 10 it will set x to 1, if it is below 10 it will set x to -1, otherwise it will set x to 0 | ; If the value is above 10 it will set x to 1, if it is below 10 it will set x to -1, otherwise it will set x to 0 | ||
if value > 10 | if (value > 10) | ||
x = 1 | x = 1 | ||
elseif value < 10 | elseif (value < 10) | ||
x = -1 | x = -1 | ||
else | else | ||
Line 107: | Line 107: | ||
; Loop until x is 10 | ; Loop until x is 10 | ||
x = 0 | x = 0 | ||
while x < 10 | while (x < 10) | ||
DoCoolStuff() | DoCoolStuff() | ||
x += 1 | x += 1 |