aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/cond.yue
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-02-17 11:22:07 +0800
committerLi Jin <dragon-fly@qq.com>2021-02-17 11:22:07 +0800
commit7066392d1c974065181d95d93274136dcd625d43 (patch)
treecf51eafc2c52cbc12246a306bca172d799193d30 /spec/inputs/cond.yue
parent90cd12ad9ef465f3e435e1bd034dcfbe4e19d016 (diff)
downloadyuescript-7066392d1c974065181d95d93274136dcd625d43.tar.gz
yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.bz2
yuescript-7066392d1c974065181d95d93274136dcd625d43.zip
stop reusing variables, rename project.
Diffstat (limited to 'spec/inputs/cond.yue')
-rw-r--r--spec/inputs/cond.yue190
1 files changed, 190 insertions, 0 deletions
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue
new file mode 100644
index 0000000..3dee99b
--- /dev/null
+++ b/spec/inputs/cond.yue
@@ -0,0 +1,190 @@
1
2you_cool = false
3
4_ = if cool
5 if you_cool
6 one
7 else if eatdic
8 yeah
9 else
10 _ = two
11 three
12else
13 no
14
15_ = if cool then no
16_ = if cool then no else yes
17
18if cool then wow cool else
19 noso cool
20
21if working
22 _ = if cool then if cool then okay else what else nah
23
24
25if yeah then no day elseif cool me then okay ya else u way
26if yeah then no dad else if cool you then okay bah else p way
27
28
29if (->)() then what ever
30
31if nil then flip me else
32 it be,rad
33
34
35if things great then no way elseif okay sure
36 what here
37
38
39if things then no chance
40elseif okay
41 what now
42
43
44if things
45 yes man
46elseif okay person then hi there else hmm sure
47
48if lets go
49 print "greetings"
50elseif "just us"
51 print "will smith" else show 5555555
52
53--
54
55if something = 10
56 print something
57else
58 print "else"
59
60hello = if something = 10
61 print something
62else
63 print "else"
64
65
66hello = 5 + if something = 10
67 print something
68
69---
70
71z = false
72
73_ = if false
74 one
75elseif x = true
76 two
77elseif z = true
78 three
79else
80 four
81
82
83out = if false
84 one
85elseif x = true
86 two
87elseif z = true
88 three
89else
90 four
91
92kzy = ->
93 if something = true
94 1
95 elseif another = false
96 2
97
98---
99
100unless true
101 print "cool!"
102
103unless true and false
104 print "cool!"
105
106unless false then print "cool!"
107unless false then print "cool!" else print "no way!"
108
109unless nil
110 print "hello"
111else
112 print "world"
113
114--
115
116x = unless true
117 print "cool!"
118
119x = unless true and false
120 print "cool!"
121
122y = unless false then print "cool!"
123y = unless false then print "cool!" else print "no way!"
124
125z = unless nil
126 print "hello"
127else
128 print "world"
129
130print unless true
131 print "cool!"
132
133print unless true and false
134 print "cool!"
135
136print unless false then print "cool!"
137print unless false then print "cool!" else print "no way!"
138
139print unless nil
140 print "hello"
141else
142 print "world"
143
144--
145
146print "hello" unless value
147
148dddd = {1,2,3} unless value
149
150
151--
152
153do
154 j = 100
155 unless j = hi!
156 error "not j!"
157
158----------------
159
160a = 12
161a,c,b = "cool" if something
162
163
164
165---
166
167j = if 1
168 if 2
169 3
170else 6
171
172
173m = if 1
174
175
176
177 if 2
178
179
180 3
181
182
183else 6
184
185
186
187nil
188
189
190