If

From Sputnik Wiki
Revision as of 09:53, 8 November 2011 by UberFoX (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

If...ElseIf...Else...EndIf

Description

Conditionally run statements.

If <expression> Then
    statements
    ...
[ElseIf expression-n Then
    [elseif statements ... ]]
    ...
[Else
    [else statements]
    ...
EndIf

Parameters

expression

If the expression is true, the first statement block is executed. If not, the first true ElseIf block is executed. Otherwise, the "Else" block is executed.

Remarks

If statements may be nested.

The expression can contain the boolean operators of AND, &&, OR, ||, NOT, ! as well as the logical operators <, <=, >, >=, ==, ==, and <> as needed.

Example

If $a == 100 Then
	println( "Value is 100" )
ElseIf $a == 200 Then
	println( "Value is 200" )
Else
	println( "No Match" )
EndIf

Example of using the logical NOT or ! operator:

If NOT $a == 100 Then
	println( "Value is 100" )
ElseIf $a == 200 Then
	println( "Value is 200" )
Else
	println( "No Match" )
EndIf
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox