Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Breaking out of iterative loops
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Johan Baltié <johan.baltie@w...>
Subject: Re: [Caml-list] Breaking out of iterative loops
Le Mardi 30 Avril 2002 22:27, Vincent Foley a écrit :
> What are the equivalents (if any) of C's 'continue' and 'break' in
> O'Caml (respectively, start another iteration and quit the loop without
> further processing)?

Think you should look for exception handling.
I do not use anything that looks like a "continue" and "break" as i generally 
avoid loop in my code and i do not think there is any.

break:
try
  for ... do
    raise End_Loop
  done
with End_Loop ->


continue:
  for ... do
try
    raise Next_Loop
with Next_Loop ->
  ....
  done

But please, for my soul sake, avoid such things unless you do really need an 
exception

-- 
Ciao

Jo

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners