Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Statement blocks are made up of lines of code delimited by colons. Lines of code preceded by an identifying string or integer are said to be labeled. Statement labels are used to mark a line of code to identify it for use with statements such as On Error Goto
.
Labels may be either valid Visual Basic identifiers—such as those that identify programming elements—or integer literals. A label must appear at the beginning of a line of source code and must be followed by a colon, regardless of whether it is followed by a statement on the same line.
The compiler identifies labels by checking whether the beginning of the line matches any already-defined identifier. If it does not, the compiler assumes it is a label.
Labels have their own declaration space and do not interfere with other identifiers. A label's scope is the body of the method. Label declaration takes precedence in any ambiguous situation.
Note
Labels can be used only on executable statements inside methods.
Place an identifier, followed by a colon, at the beginning of the line of source code.
For example, the following lines of code are labeled with Jump
and 120
, respectively:
Jump: FileOpen(1, "testFile", OpenMode.Input)
' ...
120: FileClose(1)
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Learn the AL statements in Dynamics 365 Business Central - Training
Do you want to know how to use basic AL statements? This module shows you how to use conditional statements, compound statements, and comments when developing for Business Central.