6:31 AM
then 文の実装が作業中だった
6:31 AM
func testNested3() -> Int { if .random() { print("hello") then if .random() { then 1 } else { then 2 } } else { () () then switch Bool.random() { case true: then 0 case false: then 1 } } }
6:32 AM
おそらく、ifやswitchを式モードで使うための文法で、 本文が複数文ではない場合でも、最後の文で return のような感じで then を使うと、それを式の評価値として指定できる。
6:33 AM
これは結構うまいアイデアな気がするぞ。