Re: Break Statements similar to C or C++
- From: Raffael Cavallaro <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com>
- Date: Thu, 31 May 2007 01:33:21 -0400
On 2007-05-31 00:31:04 -0400, "gokul.mano@xxxxxxxxx" <gokul.mano@xxxxxxxxx> said:
Is there any function to break from a loop as we have break in C or C+
+.
CL-USER 22 > (loop named foo
for bar = 0 then (random 100)
do (if (> bar 76) (return-from foo bar) (print bar)))
0
72
25
16
69
63
9
63
79
CL-USER 23 > (loop for bar = 0 then (random 100)
do (print bar)
when (> bar 76)
return (values))
0
24
11
21
47
60
53
21
78
CL-USER 24 > (loop for bar = 0 then (random 100)
do (print bar)
thereis (> bar 76))
0
44
97
T
CL-USER 25 > (catch 'baz
(loop for bar = 0 then (random 100)
do (print bar)
(if (> bar 76)
(throw 'baz bar))))
0
73
71
29
36
20
34
0
93
93
CL-USER 26 > (tagbody
(loop for bar = 0 then (random 100)
do (print bar)
(if (> bar 76)
(go baz)))
baz)
0
48
17
91
NIL
.
- Follow-Ups:
- Re: Break Statements similar to C or C++
- From: Timofei Shatrov
- Re: Break Statements similar to C or C++
- References:
- Break Statements similar to C or C++
- From: gokul.mano@xxxxxxxxx
- Break Statements similar to C or C++
- Prev by Date: Re: Break Statements similar to C or C++
- Next by Date: Question about loop
- Previous by thread: Re: Break Statements similar to C or C++
- Next by thread: Re: Break Statements similar to C or C++
- Index(es):