End If: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created page with "The END IF (EN IF) Statement can be used to end a multi-line IF structure. ===Comments and Examples=== A multiple-line IF structure is initiated when the IF statement end...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The END IF (EN IF) [[Statement]] can be used to end a multi-line IF structure.
The END IF (EN IF) [[Statement]] can be used to end a multi-line [[IF]] structure.


===Comments and Examples===
===Comments and Examples===
A multiple-line IF structure is initiated when the IF statement ends with an open-ended THEN or ELSE clause. (The term "open-ended" denotes a keyword that is not followed by an instruction until the next line.)
A multiple-line IF structure is initiated when the IF statement ends with an open-ended THEN or [[ELSE]] clause. (The term "open-ended" denotes a keyword that is not followed by an instruction until the next line.)


There are two ways to terminate a multiple-line IF:
There are two ways to terminate a multiple-line IF:
Line 27: Line 27:


===Syntax===
===Syntax===
END IF
[[file:Endif.png]]
[[file:Endif.png]]


Line 32: Line 33:
1.) IF nesting is allowed in multi-lined IF structures only. Nested multi-lined IFs are terminated in reverse order.
1.) IF nesting is allowed in multi-lined IF structures only. Nested multi-lined IFs are terminated in reverse order.
2.)Required to terminate a multi-line IF structure.
2.)Required to terminate a multi-line IF structure.
<noinclude>
[[Category:Statements]]
[[Category:Branching Statements]]
</noinclude>

Latest revision as of 16:04, 24 April 2014

The END IF (EN IF) Statement can be used to end a multi-line IF structure.

Comments and Examples

A multiple-line IF structure is initiated when the IF statement ends with an open-ended THEN or ELSE clause. (The term "open-ended" denotes a keyword that is not followed by an instruction until the next line.)

There are two ways to terminate a multiple-line IF:

a.) with a single-lined ELSE statement
b.) with an END IF statement.

The following example shows a multi-lined IF which is initiated with an open-ended THEN clause and which is terminated with a single-lined ELSE statement:

00010 IF X=2 THEN !:Initiates the multiple-line IF
00020 Y=1!: THEN instructions begin
00030 FOR Z=1 TO 10
00040 X$(Z)=""
00041 50  NEXT Z
00060 ELSE Y=0 !: Terminates the multiple-line IF

The following example shows a multi-lined IF which is initiated with an open-ended ELSE clause and which is terminated with an END IF statement:

00010 IF X=2 THEN Y=1 ELSE !:! Initiates the multi-line IF
00020  Y=0
00030  FOR Z=1 TO 10
00040   X$(Z)=""
00050 NEXT Z !:!ELSE instructions end
00060 END IF !:! Multi-line IF terminated

Syntax

END IF

Technical Considerations

1.) IF nesting is allowed in multi-lined IF structures only. Nested multi-lined IFs are terminated in reverse order. 2.)Required to terminate a multi-line IF structure.