Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Enabled for | Public preview | General availability |
---|---|---|
Admins, makers, marketers, or analysts, automatically | ![]() |
![]() |
Business value
The ternary operator ? :
, known from other programming languages, simplifies conditional operations in code. It makes your code easier to read and less verbose. The ternary operator is especially useful for simple conditions. It keeps your code clear and helps you focus on the programming intent. By letting you initialize variables in the same line, the ternary operator makes sure you assign values correctly while keeping your code short. With this release, AL supports the ternary operator.
Feature details
Use the ternary operator ? :
to assign one of two values to a variable, based on the condition in an expression.
Here's an example that compares using if-then-else
with the new ternary operator.
Geographic areas
Visit the Explore Feature Geography report for Microsoft Azure areas where this feature is planned or available.
Language availability
Visit the Explore Feature Language report for information on this feature's availability.
Tell us what you think
Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.
Additional resources
Conditional operators (docs)