Home » Microsoft » MB6-704 » What should you identify?
You have the following X++ statement:
You need to identify the output of the statement.
What should you identify?
A. Process was cancelled.
Wrong value of variable B variable.
B. Wrong value of variable B variable.
C. Variable2 cannot have value greater than 2.
Process was aborted.
D. Wrong value of variable B variable.
Process was cancelled.
Correct Answer: B
Explanation/Reference:
By default the integer variables VariableA and VariableB will be set 0.
Break; statement will be run as VariableA is 1.
The line error("Wrong value of variableB variable."); will be executed as VariableB VariableA.
No exception is thrown.
Note: A frequently thrown exception is Exception::error enumeration value. This exception is thrown in a variety of situations. It is common practice to write diagnostic information to the Infolog before throwing the exception, and the Global::error method is often the best way to do that.
In X++ code, the static methods on the Global class can be called without the Global:: prefix. For example, the Global::error method can be called simply as error("My message.");.
Incorrect;
Not A, not D:
Exception Break: Indicates that the user has pressed BREAK or CTRL+C.
Reference: Exception Handling with try and catch Keywords [AX 2012]