Microsoft Dynamics AX 2012 R3 Development-2 Locus IT Services

Microsoft Dynamics AX 2012 R3 Development-2

Locus IT ServicesMicrosoft Dynamics AX 2012 R3 Development-2

Lesson 3 – Conditional Statements

Conditional Statements:

Conditional statements in programming define conditions under which certain functions are performed. Conditional statements use logical expressions that are evaluated and return a value of either true or false.

There are three primary topics:

  • If statement : 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.
  • Switch statement: The switch statement is a multi-branch language construct. You can create more than two branches by using the switch statement. This is in contrast to the if statement. You have to nest statements to create the same effect.
  • Ternary operators All these are evaluated using operators: In the X++ language of Microsoft Dynamics AX, the ternary operator is a conditional statement that resolves to one of two expressions. This means that a ternary operation statement can be assigned to a variable. In comparison, an if statement provides conditional branching of program flow but cannot be assigned to a variable.

In programming languages such as X++, you can specify conditions under which a block of code must be executed or skipped. Each test evaluates to either true or false.

Different X++ keywords offer advantages depending on the details of the situation. This section has topics that describe these keywords.In the X++ language of Microsoft Dynamics AX, the ternary operator is a conditionalstatement that resolves to one of two expressions. This means that a ternary operation statement can be assigned to a variable.

 

Locus IT Project Management Office
What’s it?