Thursday, July 23, 2009

BEGIN END Statements

A compound statement is one type of control structure in C/AL.
Using Compound Statements, In some cases, the C/AL syntax only allows you to use a single statement.
If however you have to execute more than one simple statement, the statements can be written as a compound statement by enclosing the statements between the keywords BEGIN and END.
BEGIN
Statement 1;
Statement 2;
.. ;
END

The individual statements are separated by a semicolon. In C/AL a semicolon is used to separate statements, and not, as in other programming languages, as a terminator symbol for a statement. Nevertheless, an extra semicolon before an END does not cause an error because it is interpreted by the compiler as an empty statement.
Blocks
The BEGIN-END structure is also called a block. Blocks can be very useful in connection with the other control structures in C/AL

No comments: