if and if ... else Statements [AX 2012]
Updated: October 11, 2008
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The if statement evaluates a question (a condition) and executes a statement or set of statements if the condition is true. You can provide an alternative statement or set of statements that are executed if the condition is false (the else statement).
if and if...else statements are the most simple conditional statements in X++. You can also use switch statements and ternary operators.
You can nest if statements, but if the nesting of if statements becomes too deep, consider using a switch statement.
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.