NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

9.9.1 If statements

An If statement is the basic conditional statement. Each expression must be implicitly convertible to Boolean. If the expression in an If statement is True, then the statements enclosed by the If block are executed. If the expression is False, then each of the ElseIf expressions is evaluated. If one of the expressions evaluates to True, then the corresponding block is executed. If no expression evaluates to True and there is an Else block, the Else block is executed. Once a block finishes executing, execution passes to the end of the If statement.

There is also a line version of the If statement which has a single set of statements to be executed if the If expression is True and an optional set of statements to be executed if the expression is False.

IfStatement ::= BlockIfStatement | LineIfThenStatement
BlockIfStatement ::=
 If BooleanExpression [ Then ] StatementTerminator
 [ Block ]
 [ ElseIfStatement+ ]
 [ ElseStatement ]
 End If StatementTerminator
ElseIfStatement ::=
 ElseIf BooleanExpression [ Then ] StatementTerminator
 [ Block ]
ElseStatement ::=
 Else StatementTerminator
 [ Block ]
LineIfThenStatement ::= If BooleanExpression Then [ EmbeddedStatements ]
  [ Else EmbeddedStatements ] StatementTerminator
EmbeddedStatements ::=
 [ EmbeddedStatement ] |
 EmbeddedStatements : [ EmbeddedStatement ]
BooleanExpression ::=   Expression