From e6679ff5239c439236c6e5f2bb639fe7957c4e90 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 14 Jun 2018 00:49:11 -0700 Subject: [PATCH] Playing around with conditional syntax --- TODO.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/TODO.md b/TODO.md index 5d4eee6..57ed3b2 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,25 @@ # TODO Items +- if/match playground + +simple if +`if x == 1.0 { "a" } else { "b" }` + +one comparison multiple targets: +`if x == { 1.0 -> "a", 2.0 -> "b", else -> "c" }` + +different comparison operators/ method calls: +`if x { == 1.0 -> "a", eq NaN -> "n", .hella() -> "h", else -> "z" }` + +pattern matching/introducing bindings: +`if alice { .age < 18 -> "18", is Person("Alice", age) -> "${age}", else -> "none" }` + +pattern matching w/ if-let: +`if person is Person("Alice", age) { "${age}" } else { "nope" }` + + + - Next priorities: - get ADTs working, get matches working - inclusive/exclusive range syntax like .. vs ..=