aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/in_expression.yue
blob: 6e923e156a2aba52092f8bcf0dffa8a1d08621a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-a^2 in {1, 2, 3} |> f

a, b = x(...) not in [1, 3], 2

d = (tb.x.y ...) not in [1, 3]

has = "foo" in { "bar", "foo" }

if a in {1} and b in {2, 3, 4} or c in [1, 10]
	print a, b, c

switch val
	when 1, 2, 3
		print "1, 2, 3"

	when not in (0, 100]
		print "not (0 < val <= 100)"

	when in [200, 300)
		print "200 <= val < 300)"

	when not in {333, 444, 555}
		print "not 333, 444 or 555"

do return y not in (a, b)

do
	exist = item in list
	check item in list

do
	item = get!
	exist = item in list
	check item in list

do
	item = get!
	list = {1, 2, 3}
	not_exist = item not in list
	check item in list
	check item in {1, 2, 3}
	check item(...) in {[1]: 1, [2]: 2, [3]: 3}

do
	check -> x in tb
	check -> x not in tb
	local x, tb
	check -> return x in tb
	check -> x not in tb

nil