repeat until

rishi_smhsrishi_smhs Member Posts: 13
can anyone could expalin me how to use repeat...until statement.plz explain it with example.

Comments

  • rajpatelbcarajpatelbca Member Posts: 178
    generally, Repeat statement is used as looping statement in record type of variable.

    syntax :

    REPEAT

    UNTILL Record.next(step)=0.


    eg.

    Repeat

    message(CustRec. Name);
    untill CustRec.next=0;


    in above example, it will display customer name for all records available in CustRec Record type variable. when record reach at last record after that CustRec.next statement return 0. thus loop is completed.

    if you want to read more about it then refer. online help avalible in Navision.
    Experience Makes Man Perfect....
    Rajesh Patel
  • DenSterDenSter Member Posts: 8,305
    Doesn't have to be a record, it is a looping mechanism plain and simple. It repeats a number of statements until a condition is met. One of my former coworkers created an endless loop:
    REPEAT
    UNTIL HellFreezesOver;
    
    HellFreezesOver is a boolean variable that never gets set :mrgreen:
  • rajpatelbcarajpatelbca Member Posts: 178
    :o oohh same on me..
    Experience Makes Man Perfect....
    Rajesh Patel
  • TomasTomas Member Posts: 420
    usually it's used as
    IF Rec.FIND('-') THEN
    REPEAT
    ..
    UNTIL Rec.NEXT <= 0;
    
  • DenSterDenSter Member Posts: 8,305
    When looping a set of records it's more like this:
    IF Rec.FINDSET THEN BEGIN
      // do what you need to do before the looping starts
      REPEAT 
        // do what needs to be repeated  
      UNTIL Rec.NEXT = 0;
      // clean up after the loop
    END;
    
  • apertierraapertierra Member Posts: 61
    Even simpler: reviewing pages 318-319 from the application designer guide that it's included in the docs folder of the original CD.
Sign In or Register to comment.