8.18
top
← prev up next →

while/until loops for RacketπŸ”— i

JavaCommons Technologies <javacommons@gmail.com>

This basically provides while, until, break and continue.

1Example and usageπŸ”— i

(requirewhile-until)
 
(while(not(string=?(read-line)
"quit"))
(printf"quit?"))
 
(while#t
(defineinput(read-line))
(unless(regexp-match#px"please"input)
(printf"Youdidn'tsayplease\n")
(continue))
(when(regexp-match#px"quit"input)
(break)))
(requirewhile-until)
(requireoutput)
 
(definen5)
(while(>n0)
(dumpn)
(set!n(-n1))
)
(definem5)
(until(<m1)
(dumpm)
(set!m(-m1))
)

2ReferenceπŸ”— i

syntax

( whiletestbody...)

Repeat the evaluation of the body so long as test is true.

syntax

( untiltestbody...)

Repeat the evaluation of the body so long as test is false.

syntax

( break)

Break out of the innermost loop.

syntax

( continue)

Restart the innermost loop.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /