File: break_continue.hy

package info (click to toggle)
hy 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,632 kB
  • sloc: python: 7,299; makefile: 38; sh: 27
file content (12 lines) | stat: -rw-r--r-- 281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
(defn test-break-breaking []
  (defn holy-grail [] (for [x (range 10)] (when (= x 5) (break))) x)
  (assert (= (holy-grail) 5)))


(defn test-continue-continuation []
  (setv y [])
  (for [x (range 10)]
    (when (!= x 5)
      (continue))
    (.append y x))
  (assert (= y [5])))