diff options
author | Li Jin <dragon-fly@qq.com> | 2021-02-17 11:22:07 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-02-17 11:22:07 +0800 |
commit | 7066392d1c974065181d95d93274136dcd625d43 (patch) | |
tree | cf51eafc2c52cbc12246a306bca172d799193d30 /spec/inputs/switch.yue | |
parent | 90cd12ad9ef465f3e435e1bd034dcfbe4e19d016 (diff) | |
download | yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.gz yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.bz2 yuescript-7066392d1c974065181d95d93274136dcd625d43.zip |
stop reusing variables, rename project.
Diffstat (limited to 'spec/inputs/switch.yue')
-rw-r--r-- | spec/inputs/switch.yue | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/inputs/switch.yue b/spec/inputs/switch.yue new file mode 100644 index 0000000..ac3dbea --- /dev/null +++ b/spec/inputs/switch.yue | |||
@@ -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 | |||