aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-06-07 09:42:50 +0800
committerLi Jin <dragon-fly@qq.com>2023-06-07 09:42:50 +0800
commit2a3e50752ade96c3b5d6b1103937bef0f6b31157 (patch)
treef7ae2654ac96009a9e5dbe9667e480cc920a2868 /spec/inputs
parent738154d37dd4ec20b09acd0f9f81601d0dc069ba (diff)
downloadyuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.tar.gz
yuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.tar.bz2
yuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.zip
add new syntax of in-expression.
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/in_expression.yue26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/inputs/in_expression.yue b/spec/inputs/in_expression.yue
new file mode 100644
index 0000000..2756fe8
--- /dev/null
+++ b/spec/inputs/in_expression.yue
@@ -0,0 +1,26 @@
1-a^2 in {1, 2, 3} |> f
2
3a, b = x(...) not in [1, 3], 2
4
5d = (tb.x.y ...) not in [1, 3]
6
7if a in {1} and b in {2, 3, 4} or c in [1, 10]
8 print a, b, c
9
10switch val
11 when 1, 2, 3
12 print "1, 2, 3"
13
14 when not in (0, 100]
15 print "not (0 < val <= 100)"
16
17 when in [200, 300)
18 print "200 <= val < 300)"
19
20 when not in {333, 444, 555}
21 print "not 333, 444 or 555"
22
23do return y not in (a, b)
24
25nil
26