Loops/Foreach: Difference between revisions

Content deleted Content added
Line 593:
=={{header|Ela}}==
===Standard Approach===
<lang ela>open consolemonad imperativeio
 
each writen [1..10]</lang> = do return ()
each (x::xs) = do
Function 'each' is defined in imperative module as:
putStrLn $ show x
<lang ela>each f (x::xs) = f x $ each f xs
each _ [] =each ()xs</lang>
This also can be accomplished using 'map':
<lang ela>open console list
 
_ = map writen [1..10]</lang>
 
===Alternate Approach===