Begin
Purpose
To define the beginning and end of a block of commands whose execution is to be controlled by other commands.
Syntax
Begin
…
End
What It Does
Begin defines the start of a block of commands. End defines the end of the block. Execution of the commands in the block will only occur if the Begin command itself executes.
Example
Procedure OnClick
Integer bReady // A flag to see if we can continue...
Integer iTimes
Show "This is Hal. Earthling, you are truly prepared"
Showln " to go forward today..."
Move 0 to iTimes
Move MBR_NO to bReady
While (bReady = MBR_NO)
Move (YesNo_Box("Haven't you forgotten something? ", "Important!", MB_DEFBUTTON2)) to bReady
Increment iTimes
If (bReady = MBR_NO)
Begin
// Begins can be nested
If (iTimes = 1)
Begin
Showln
Show "I'm sure you have"
End
Else
Show "I insist. You have"
Show " forgotten something."
If (iTimes > 10)
Begin
Showln "Please insert floppy diskette into a CD ROM drive."
If (iTimes > 20)
Begin
Showln "*** This does not compute..."
If (iTimes > 40)
Showln "This is not a drill..."
End
End
Showln "You will be given another chance before we go on"
Showln
End
Loop
End_Procedure
Notes
- You may place
Begin .. Endblocks inside otherBegin ... Endblocks up to a limit of 40. You may freely intermingle them with other block control commands (loops). However, you may not overlap them — you must end the innermost block first, then the next-innermost, and so on.