topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Program building blocks

Program building blocks in AL covers operators, statements, system-defined variables, access modifiers and XML comments. It answers questions about AL syntax, operator precedence, flow control, symbol visibility and inline code documentation.

Path: Development > Programming in the AL language > Program building blocks · tier official · system development · narrative reviewed (checked by Opus)

Overview

This section collects the core elements used to write AL code. The reference pages cover operators, system-defined variables such as Rec and CurrPage, access modifiers for controlling visibility, and XML comments for documentation. A Statements subtopic covers simple and control statements.

Start with Statements and AL operators to learn syntax and evaluation order. Then read System-defined variables to see how code reaches the current record, page or report. Use Access Modifiers when designing APIs, and XML comments when documenting code for IntelliSense and ALDoc.

Key points

  • AL operators page lists arithmetic, comparison, logical, conditional and compound assignment operators, plus precedence (operator hierarchy).
  • Statements subtopic (2 pages) covers simple statements: assignment, method calls, AssertError.
  • Control statements include if-then-else, case, for, foreach, while, repeat-until, break and continue.
  • System-defined variables include Rec, xRec, CurrPage, CurrReport, RequestOptionsPage and CurrFieldNo.
  • Access modifiers are internal, local, protected and public, enforced at compile time for tables, fields, codeunits and queries.
  • The internalsVisibleTo setting is described alongside internal access.
  • XML comments use triple slashes and supported XML tags on codeunits, tables, interfaces and methods.
  • XML comments enable IntelliSense and autogenerated help with ALDoc.

Subtopics

More Learn pages

  • AL operators: Describes the operators you can use in AL for Business Central.
  • System-defined variables: Describes the system-defined variables that are automatically declared and initialized in AL for Business Central.
  • Using Access Modifiers in AL: Describes how the AL access modifiers can be used in code.
  • XML comments in code: Learn about adding documentation to AL code by including XML elements in a special syntax.

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

What Learn documents here 6 Learn pages