Login  Register

Re: "break" equivalent in Macro language.

Posted by ved sharma on Dec 07, 2010; 2:53pm
URL: http://imagej.273.s1.nabble.com/break-equivalent-in-Macro-language-tp3686262p3686264.html

a=0;
for (i=0;i<10;i++) {
   code1;
   a++;
   if (a==3) break;
   code2;
}
code3;


In the above example, I want to break as soon as a==3, so that it does not execute code2. It should terminate for loop and go on to execute code3.

Michael, setting i to a very large value or using a variable done (as in your example) still evaluates the condition i<10, which causes code2 to run.

Ved