Article View: comp.lang.misc
Article #5442Re: Loops
From: Ken Johnson
Date: Mon, 11 Apr 1988 09:31
Date: Mon, 11 Apr 1988 09:31
37 lines
1470 bytes
1470 bytes
How to allow breaking out of arbitrary loops, which you might otherwise have to do like this: >> done := false; >> while not done do begin >> do_some; >> done := done | done_now; >> if not done then begin >> do_some_more; >> done := done | done_already; >> end; >> else do_even_more; >> end; In some recent versions of Logo, and also in Lisp, you have the `throw/catch' construct, which I think looks a lot better: to a_program catch 'foo [ forever [ repeated_bit if <condition> [ throw 'foo ] other_repeated_bit ] ] last_bit When the `throw 'foo' is executed, execution resumes at `last_bit'. Catches may be nested. -- ------------------------------------------------------------------------------ From Ken Johnson, AI Applications Institute, The University, EDINBURGH Phone 031-225 4464 ext 212 Email k.johnson@ed.ac.uk
Technical Details
Message-ID:
<341@aiva.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!kenReferences:
<2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <AWJ9X4y00WAHE53kVi@andrew.cmu.edu> <270@bby-bc.UUCP> <4266@ihlpf.ATT.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!aiva!ken From: ken@aiva.ed.ac.uk (Ken Johnson) Newsgroups: comp.lang.misc Subject: Re: Loops Message-ID: <341@aiva.ed.ac.uk> Date: 11 Apr 88 09:31:19 GMT References: <2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <AWJ9X4y00WAHE53kVi@andrew.cmu.edu> <270@bby-bc.UUCP> <4266@ihlpf.ATT.COM> Reply-To: ken@uk.ac.ed.aiva (Ken Johnson,E32 SB x212E) Followup-To: comp.lang.misc Organization: Dept. of AI, Univ. of Edinburgh, UK Lines: 37 Summary: catch, throw