how to break from a loop

i am trying break; command to exit from loop but it is not working ,dont know why???can anyone tell me how to break from loop and why break; is not working

Could you give us an example of your loop? Or explain a little more detailed what you want to do? Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

thank for your reply the example is record.find(’-’); repeat if record.age = 45 then break;//here break is not working until <=0; the error we get is(declare break in global variables) but it is a C/AL function…why? regards anoop verma

Hi Anoop, well… we have got other alternatives to get of the loop…try this r.FIND(’-’); REPEAT IF = 45 THEN flag:= TRUE; UNTIL (r.NEXT <=0) OR (flag = TRUE); hope this is helpful for time being !!! Lakshmi Valluru

That should do it:

// ... any processing
until ( = 0) OR (record.age = 45);

Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP Edited by - stryk on 2002 Jul 17 11:55:15

Thanks to all of you for your valuable reply,i did solve my problem…But how Break function works appart from currReport.break??? with regards anoop

BREAK does work essentially as you were trying to use it. But the syntax requires that you use CurrReport.BREAK (not case sensitive). If you leave off the CurrReport. prefix, you will get the error message you reported, namely the compiler asking you to define the unknown variable “break”. Dave Studebaker Liberty Grove Software A Navision Services Partner