home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,310 of 2,978   
   Rudy Velthuis to robert   
   Re: continue/break loop early in Pascal?   
   13 Dec 06 20:38:50   
   
   XPost: comp.lang.pascal.delphi.misc   
   From: newsgroups@rvelthuis.de   
      
   robert wrote:   
      
   > Sorry for dummy Pascal question - I have to fumble in an old TP6.0   
   > Pascal program and I was on Pascal some 10 years ago..   
   >   
   > How can one break out / continue a loop early in Pascal - thus what   
   > is "break" / "continue" / "next" / "return" in C, Python, ...  And   
   > how to return early from a function / procedure?   
   >   
   > procedure xy;   
   > begin   
   >  while True do begin   
   >     if cond1=True then ?continue?;   
   >     if cond2=True then ?break?;   
   >     if cond3=True then ?return?;   
   >  end;   
   > end;   
      
   TP6 should have Break and Continue. But note that you can replace   
   Continue with an if-clause:   
      
     for ...   
     begin   
       ...   
       if X then   
         Continue;   
       // rest   
     end;   
      
   is equivalent to:   
      
     for ...   
     begin   
       ...   
       if not X then   
       begin   
         // rest   
       end;   
     end;   
      
   --   
   Rudy Velthuis      http://rvelthuis.de/   
      
   "Devlin's First Law - Buyer beware: in the hands of a charlatan,   
   mathematics   
    can be used to make a vacuous argument look impressive.   
    Devlin's Second Law - So can PowerPoint." -- Keith Devlin   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca