topic hubAL Developmentofficial - Microsoftunreviewed - model text not yet checked

Statements

AL statements cover the building blocks that make up AL code: simple statements (assignment, method calls, AssertError) and control statements (if-then-else, case, for, foreach, while, repeat-until). It answers questions about statement syntax, compound assignment operators, test assertions, and how to branch or loop.

Path: Development > Programming in the AL language > Program building blocks > Statements · tier official · system development · narrative unreviewed (model text not yet checked)

Overview

Statements are the basic units of executable code in AL. This section has two pages, split by whether a statement changes the flow of execution.

AL simple statements run sequentially and do not alter code flow. The page covers assignment statements, method statements, compound assignment operators and AssertError statements used in tests. AL control statements cover conditional execution, loops and statement grouping, with programming conventions and examples. The control statements page lists a 2023 release wave 1 version.

Start with simple statements if you need assignment or method call syntax. Go to control statements when you need to choose between branches or repeat code.

Key points

  • Simple statements are assignment, method, and AssertError statements, and they run sequentially without changing code flow.
  • Compound assignment operators are described on the simple statements page.
  • AssertError statements are used for test assertions.
  • Conditional execution uses if-then-else and case statements.
  • Loops are available as for, foreach, while, and repeat-until.
  • Control statements can also group statements, and the page gives programming conventions and examples.
  • The control statements page references 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.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 2 Learn pages