Expand my Community achievements bar.

Break and continue without loop expressions in FormCalc

Avatar

Level 1

Hi! I have a question: how break and continue statesments behave outside the loops expressions. If there are no loop expression before break statesment, then LC generetes an error "break is not enclosed in a loop". But after any loop expression its problem disappears.

This is sample with error:

var A = 0
break;     //error
while ( A < 3) do
A = A + 1
endwhile

And without error:

var A = 0
while ( A < 3) do
A = A + 1
endwhile
break;    //works correctly

Please, explane this behavior.

2 Replies

Avatar

Former Community Member

Sorry ...have been away on vacation and I am just returning now ...

I cannot explain the behaviour you are seeing other than saying that the break statement is being used incorrectly. The break in javascript is used to terminate the processing of a loop. By adding it before a loop the error makes sense.....but I woudl have thought the same thing woudl have happened in adding it outside of the loop. This is pure javascript at this point has has no bearing on any extensions added by Adobe. It might be a bug in the javascript engine that is used in Acrobat (this is not written by Adobe but is written by another company and icensed to be used by Adobe). It woudl be interesting to see how other javascript implementations handle this.

Hope that helps

Paul