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