Jump to content

Loops/While: Difference between revisions

m
(→‎{{header|Haskell}}: add monadic implementation)
Line 207:
<lang haskell>import Control.Monad (when)
 
whileM :: (Monad m) => m Bool -> m ()a -> m ()
whileM cond body = do c <- cond
when c (body >> whileM cond body)</lang>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.