topic hubAL Developmentofficial - Microsoftunreviewed - model text not yet checked

The AL programming language

The AL programming language section covers language fundamentals for Business Central extensions: statements, methods, error handling, labels, access modifiers and XML comments. It also covers variables and types, object types, preprocessor directives and code analysis. It answers how to write, structure and extend AL code.

Path: Development > The AL programming language · tier official · system development · narrative unreviewed (model text not yet checked)

Overview

This section documents AL, the language used to build Business Central extensions. The hub’s own pages cover the core constructs: simple and control statements, methods, complex return types, labels, access modifiers, error handling and XML comments. “Programming in AL” gives the general fundamentals, including variable declarations, triggers and code reuse.

Subtopics go deeper. Variables, types, and operators covers declaration, scoping, system variables such as Rec and CurrPage, operator precedence and type conversion. Objects describes each AL object type and how to extend it. Preprocessor directives covers conditional compilation, regions and pragmas. Code analysis is a further subtopic, but no summary of it was provided.

Start with “Programming in AL” for the basics, then move to the statements and methods pages. Use the Objects subtopic when working on a specific object type. The AL development environment reference overview and the FAQ help with object, property and trigger lookups and with tooling questions.

Key points

  • Control statements: if-then-else, case, for, foreach, while and repeat-until.
  • Simple statements: assignment (including compound assignment operators), method statements and AssertError for tests.
  • Access modifiers (internal, local, protected, public) control visibility at compile time. The internalsVisibleTo setting is also covered.
  • Error handling: error dialogs, try methods, error collection, the ErrorInfo data type and error telemetry.
  • Labels are translatable string constants with Comment, Locked and MaxLength parameters, used for captions, tooltips and messages.
  • Objects subtopic covers codeunits, tables, pages, queries, reports, XMLports, enums, control add-ins and permission sets.
  • Preprocessor directives: #if/#else/#elif/#endif, #define/#undef, #region, and #pragma warning and implicitwith.
  • XML comments with triple slashes enable IntelliSense and autogenerated documentation with ALDoc.

Subtopics

More Learn pages

  • AL complex types: With AL complex types, you can return most types from procedures in AL for Business Central
  • AL control statements: Compound, conditional, and repetitive control statements in AL for Business Central.
  • AL development environment reference overview: Overview of the objects in the AL Language development environment.
  • AL error handling: Deal with unexpected situations that occur when code is run in AL for Business Central.
  • AL simple statements: Describes the simple, single-line statements in AL for Business Central with examples
  • FAQ for Developing in AL: Overview of frequently asked questions for development using the AL language.
  • Programming in AL: AL is the programming language used for manipulating data such as retrieving, inserting, and modifying records in a Business Central database. It controls the execution of the various application objects, such as pages, reports, or codeunits.
  • Using Access Modifiers in AL: Describes how the AL access modifiers can be used in code.
  • Working with AL methods: Methods also known as procedures are a fundamental programming element in AL for Business Central.
  • Working with Labels in AL for Business Central: Learn how to work with labels in AL, the translatable string constants that Business Central displays as captions, descriptions, and messages.
  • XML comments in code: Learn about adding documentation to AL code by including XML elements in a special syntax.

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 8 of 45 Learn pages

Show 32 more