static void Job(Args _args)
{
int number=10;
do
{
print (strfmt("current number = %1", number));
number --;
}while (number != 0)
}
This is a job just for testing do-while in X++ , and I get a "syntax error" in the last '}'
I'm new to Dynamics AX and to X++, so I don't know if there's something I'm missing, but I'd say it should work.
-----[EDIT]-----
second part of the question was moved to a separate question
As in many C style languages, the DO WHILE loop does require a semicolon at the end of the while test:
http://msdn.microsoft.com/en-us/library/aa842320.aspx
SYNTAX
do
{ statement }
while
( expression ) ;
Fixed code:
static void Job(Args _args)
{
int number=10;
do
{
print (strfmt("current number = %1", number));
number --;
}while (number != 0); <-- semicolon required here
}
The reason the error doesn't occur until the final brace is that the compiler doesn't realize there's something missing until that point in the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With