diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-10 16:30:34 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-10 16:30:34 +0800 |
| commit | 52a6536103f46c26a3ba9b149b0fe7b40d524d8c (patch) | |
| tree | 67e4759f8e1ea922079d0e162d84ecba5e558261 /spec/inputs/switch.moon | |
| parent | 975167856ed0b11c2ede03c6eb750ca4e4a6a7fc (diff) | |
| download | yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.tar.gz yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.tar.bz2 yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.zip | |
update.
Diffstat (limited to 'spec/inputs/switch.moon')
| -rw-r--r-- | spec/inputs/switch.moon | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/inputs/switch.moon b/spec/inputs/switch.moon new file mode 100644 index 0000000..3bc179b --- /dev/null +++ b/spec/inputs/switch.moon | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | |||
| 2 | switch value | ||
| 3 | when "cool" | ||
| 4 | print "hello world" | ||
| 5 | |||
| 6 | |||
| 7 | switch value | ||
| 8 | when "cool" | ||
| 9 | print "hello world" | ||
| 10 | else | ||
| 11 | print "okay rad" | ||
| 12 | |||
| 13 | |||
| 14 | switch value | ||
| 15 | when "cool" | ||
| 16 | print "hello world" | ||
| 17 | when "yeah" | ||
| 18 | [[FFFF]] + [[MMMM]] | ||
| 19 | when 2323 + 32434 | ||
| 20 | print "okay" | ||
| 21 | else | ||
| 22 | print "okay rad" | ||
| 23 | |||
| 24 | out = switch value | ||
| 25 | when "cool" then print "hello world" | ||
| 26 | else print "okay rad" | ||
| 27 | |||
| 28 | out = switch value | ||
| 29 | when "cool" then xxxx | ||
| 30 | when "umm" then 34340 | ||
| 31 | else error "this failed big time" | ||
| 32 | |||
| 33 | with something | ||
| 34 | switch \value! | ||
| 35 | when .okay | ||
| 36 | "world" | ||
| 37 | else | ||
| 38 | "yesh" | ||
| 39 | |||
| 40 | fix this | ||
| 41 | call_func switch something | ||
| 42 | when 1 then "yes" | ||
| 43 | else "no" | ||
| 44 | |||
| 45 | -- | ||
| 46 | |||
| 47 | switch hi | ||
| 48 | when hello or world | ||
| 49 | greene | ||
| 50 | |||
| 51 | -- | ||
| 52 | |||
| 53 | switch hi | ||
| 54 | when "one", "two" | ||
| 55 | print "cool" | ||
| 56 | when "dad" | ||
| 57 | no | ||
| 58 | |||
| 59 | switch hi | ||
| 60 | when 3+1, hello!, (-> 4)! | ||
| 61 | yello | ||
| 62 | else | ||
| 63 | print "cool" | ||
| 64 | |||
