[racket] Exiting a for loop early

From: Justin Zamora (justin at zamora.com)
Date: Tue Jul 19 20:24:51 EDT 2011

Is there a built in way to exit the various kinds of for loops early?
I've been using code like:

(let/ec break
  (for ([i (in-range 1 100)]
        #:when (condition? i))
         (break i))))

Is there a better way?


Posted on the users mailing list.