AL Control Statements in Business Central:
(1) AL consist of one or more statements, which are executing the information from top-down order. They are divided into the following main group as below:
- AL Compound Statement.
- AL Conditional Statement.
- AL Repetitive Statement.
(2) AL Compound Statement: It is defined as enclosing the statements between the “BEGIN & END”.
(3) AL Conditional Statement: It is defined to specify a condition & one or more commands to execute if the condition is evaluated as true or false. It is divided into two types:
- IF-THEN-ELSE- for two choices.
- CASE – more than two choices.
(4) AL Repetitive Statement: It may be defined as a loop statement. It has many ways to execute information in the table.
- FOR: Repeats the inner statement until a counter variable equals the maximum or minimum value.
- FOREACH: Repeats the inner statement for each statement in a List.
- WHILE: Repeats the inner statement as long as the specified condition is true.
- REPEAT: Repeats the inner statements until the specified conditions evaluate to true.