BEGIN-END compound statement

In C/AL, there are instances where the syntax only allows the use of a single statement. However, a design may require the execution of several (or many) code statements.

C/AL provides at least two ways to address this need. One method is to have the single statement call a function that contains multiple statements.

However, inline coding is often more efficient to run and to understand. So, C/AL provides a syntax structure to define a Compound Statement or Block of code. A compound statement containing any number of statements can be used in place of a single code statement.

A compound statement is enclosed by the reserved words BEGIN and END. The compound statement structure looks like this:

BEGIN 
<Statement 1>;
<Statement 2>;
..
<Statement n>;
END

The C/AL code contained within a BEGIN - END block should be indented two characters, as shown in the preceding pseudocode snippet, to make it obvious that it is a block of code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.23.127.197