Difference between revisions of "If"
m
minor correction
imported>Max (An important note on one-lined else statements) |
imported>Max m (minor correction) |
||
Line 110: | Line 110: | ||
Additional Notes: | Additional Notes: | ||
Script parser seems to have problems with one-lined else statements. I personally observed how a line | Script parser seems to have problems with one-lined else statements. I personally observed how a line | ||
else set varname to somevalue ;(exactly: else set MTseason to 1) | |||
caused the script to ignore it completely (MTseason always stayed at 0). Changing it to | caused the script to ignore it completely (MTseason always stayed at 0). Changing it to | ||
else | |||
set varname to somevalue | |||
immediately solved the problem. I guess you can also use parentheses to enclose the action part of the statement. | immediately solved the problem. I guess you can also use parentheses to enclose the action part of the statement. | ||
I'm writing this because many programming and scripting languages let you use the original version of the statement without similar problems. You should also know is that there won't be any error messages to warn you, so (since the line appears to be correct) you may spend a lot of time locating the source of the problem. | I'm writing this because many programming and scripting languages let you use the original version of the statement without similar problems. You should also know is that there won't be any error messages to warn you, so (since the line appears to be correct) you may spend a lot of time locating the source of the problem. |