Difference between revisions of "If"
Jump to navigation
Jump to search
Added overview, else/elseif/endif information
imported>Gblues (Moving the comparison operator list from the "commands" topic.) |
imported>Gblues (Added overview, else/elseif/endif information) |
||
Line 1: | Line 1: | ||
The <tt>if</tt> statement allows you to execute (or not execute) a block of script commands based on one or more comparisons that you specify. Oblivion's <tt>if</tt> command is very powerful and comparable to "real" programming languages. | The <tt>if</tt> statement allows you to execute (or not execute) a block of script commands based on one or more comparisons that you specify. Oblivion's <tt>if</tt> command is very powerful and comparable to "real" programming languages. | ||
== Overview == | |||
An if statement uses the following syntax: | |||
<pre> | |||
if expressionA [comparison] expressionB | |||
; test "expressionA [comparison] expressionB" passed | |||
elseif expressionB [comparison] expressionC | |||
; test "expressionB [comparison] expressionC" passed | |||
else | |||
; none of the above tests passed | |||
endif | |||
</pre> | |||
The <tt>else</tt> and <tt>elseif</tt> statements are optional. | |||
== Comparison Operators == | == Comparison Operators == | ||
Line 64: | Line 80: | ||
IF a * ( 5 + c ) - 14 == b | IF a * ( 5 + c ) - 14 == b | ||
IF 2*(a*(5+c)-14)==b - -b | IF 2*(a*(5+c)-14)==b - -b | ||
[[Category:Commands]] | [[Category:Commands]] |