1
私は本のエルムの章を読んでいます7つのより多くの言語を7週間で。 43ページ は、著者は次のように複数行if
を説明します条件:Elmの複数行if文の構文はどのようになっていますか?
x = 5
if | x < 0 -> "too small" \
| x > 0 -> "too big" \
| otherwise -> "just right"
しかし、エルム-REPLはSYNTAX PROBLEM
文句:
> if | x < 0 -> "too small" \
| | x > 0 -> "too big" \
| | otherwise -> "just right"
-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm
I ran into something unexpected when parsing your code!
3| if | x < 0 -> "too small"
^
I am looking for one of the following things:
an expression
whitespace
- 複数行if文?
else
文 - ドキュメント(http://elm-lang.org/docs/syntax)で
if
の使用方法を発見しました。本の中で説明されている のような複数行の文を作成することは可能ですか?