diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-10-08 10:01:29 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-10-08 10:01:29 +0100 |
| commit | a5c6340316245f4f63e74d307f9d7c8be09360c6 (patch) | |
| tree | 43d2c68064a5ca31428e22f978a2f0283e2f3589 /code | |
| parent | c5d20d2eef6c25b23c2aa69cdc1dbc7ce7d6753a (diff) | |
"Maybe-fy" operator
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/code/demo.odin b/code/demo.odin index 786392b77..e3e68596c 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -1,16 +1,6 @@ #import "fmt.odin" - main :: proc() { - maybe_print :: proc(x: ?int) { - if v, ok := x?; ok { - fmt.println(v) - } else { - fmt.println("nowt") - } - } - - maybe_print(123) // 123 - maybe_print(nil) // nowt + x := ?123 } |