Statements
AL statements cover the building blocks of AL code: simple statements (assignment, method calls, AssertError) and control statements (if-then-else, case, for, foreach, while, repeat-until, break, continue). They answer questions about syntax, flow control and compound assignment operators.
- 2Learn pages
- 1videos
Path: Development > Programming in the AL language > Program building blocks > Statements · tier official · system development · narrative reviewed (checked by Opus)
Overview
Statements are the units of execution in AL code. This section has two pages that split them by whether they change the flow of code.
AL simple statements run sequentially and do not alter flow. The page covers assignment statements, method statements, compound assignment operators and AssertError statements used in tests. AL control statements covers conditionals and loops, with syntax and programming conventions.
Start with the simple statements page for basic syntax, then go to the control statements page when you need branching or iteration.
Key points
- Simple statements run in sequence and do not change code flow.
- Simple statement types: assignment, method and AssertError.
- Compound assignment operators are documented on the simple statements page.
- AssertError statements are used for test assertions.
- Conditional control statements: if-then-else and case.
- Loop statements: for, foreach, while and repeat-until.
- break and continue statements are covered with the loops.
- The control statements page lists 2023 release wave 1.
Learn pages
- AL control statements: Compound, conditional, and repetitive control statements in AL for Business Central.
- AL simple statements: Describes the simple, single-line statements in AL for Business Central with examples
Videos and posts
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- The “Continue” Keyword Finally Comes to AL — 3 Practical Examples (BC 2025 Wave 1) (video): “continue keyword in AL”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.