mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
27 lines
584 B
Text
27 lines
584 B
Text
app [main!] { pf: platform "effects-platform/main.roc" }
|
|
|
|
import pf.Effect
|
|
|
|
main! : {} => {}
|
|
main! = \{} ->
|
|
["Welcome!", "What's your name?"]
|
|
|> forEach! Effect.putLine!
|
|
|
|
line = Effect.getLine! {}
|
|
|
|
if line == "secret" then
|
|
Effect.putLine! "You found the secret"
|
|
Effect.putLine! "Congratulations!"
|
|
else
|
|
{}
|
|
|
|
Effect.putLine! "You entered: $(line)"
|
|
Effect.putLine! "It is known"
|
|
|
|
forEach! : List a, (a => {}) => {}
|
|
forEach! = \l, f! ->
|
|
when l is
|
|
[] -> {}
|
|
[x, .. as xs] ->
|
|
f! x
|
|
forEach! xs f!
|