Difference between revisions of "Statement Reference"
m
no edit summary
imported>Chesko (Discovered a major foot-gun related to While loops and variable lifetime. Documenting it here.) |
imported>Teapare m |
||
(One intermediate revision by one other user not shown) | |||
Line 13: | Line 13: | ||
<br> | <br> | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; Create a float variable | ; Create a float variable named seconds that starts with a default value | ||
float seconds = CurrentTimeInMinutes() * 60.0f | float seconds = CurrentTimeInMinutes() * 60.0f | ||
</source> | </source> | ||
Line 100: | Line 100: | ||
x = 0 | x = 0 | ||
endIf | endIf | ||
</source> | |||
<br> | |||
<source lang="papyrus"> | |||
; if the sum of x and y is less than 10, set z to 1, otherwise set z to -1. | |||
if ((x + y) < 10) | |||
z = 1 | |||
else | |||
z = -1 | |||
endif | |||
</source> | </source> | ||