Just studying for my upgrade exam and came across the following test question. I thought in this case the answer would be both @While and also @For but it´s only @While. Can anyone point out the difference for me please ?
Which @function tests a condition before executing its statements and executes a block of statements repeatedly while a given condition is true?
@For
@While
@DoWhile
@ForWhile
Subject: Difference between @While and @For ?
Are you sure the answer isn’t @DoWhile? From Designer Help, that’s the only one that it says checks the condition after executing the statements. @For and @While check the condition before.
Subject: RE: Difference between @While and @For ?
Doh ! Sorry, have now corrected it in my original post
Subject: Difference between @While and @For ?
Actually, both @For AND @While are INCORRECT. The correct answer is @DoWhile. (Which self-test software are you using?)
From the help file:
@For
Executes one or more statements iteratively while a condition remains true. Executes an initialization statement. Checks the condition before executing the statements and executes an increment statement after executing the statements.
@While
Executes one or more statements iteratively while a condition remains true. Checks the condition before executing the statements.
@DoWhile
Executes one or more statements iteratively while a condition remains true. Checks the condition after executing the statements.
Subject: Difference between @While and @For ?
I agree totally with your original opinion. @For certainly tests a condition before executing and executes as long as the condition remains true. It ALSO performs an initialise & increment but as the question doesn’t say"Which @function ONLY tests a condition before executing its statements and executes a block of statements repeatedly while a given condition is true?"
it doesn’t exclude @For.
Unfortunately you cannot always rely on exam questions being properly formulated.
Subject: RE: Difference between @While and @For ?
Thanks Haydn, it´s true some of the questions are phrased so as it´s difficult to understand how they get to the answer. I thought I was missing something here but now know I´m not. Thanks again.
BTW its SelfTest Software, used them for all my other R5 admin and dev and think they´re great. Unfortunately I only started using it as the online mentor feature was running out so couldn´t get help on this one from them.