diff options
Diffstat (limited to 'spec/inputs')
-rw-r--r-- | spec/inputs/funcs.yue | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/inputs/funcs.yue b/spec/inputs/funcs.yue index 0e45ff1..e647edc 100644 --- a/spec/inputs/funcs.yue +++ b/spec/inputs/funcs.yue | |||
@@ -158,4 +158,39 @@ args = (f,g,m | |||
158 | return 1 if n == 0 | 158 | return 1 if n == 0 |
159 | n * @(n-1) | 159 | n * @(n-1) |
160 | 160 | ||
161 | do | ||
162 | items.every (item) -> | ||
163 | if item.field | ||
164 | value = item.field.get "abc" | ||
165 | if value | ||
166 | switch value\get! | ||
167 | when 123 | ||
168 | return false | ||
169 | when 456 | ||
170 | handle item | ||
171 | true | ||
172 | |||
173 | items.every (item): true -> | ||
174 | if item.field | ||
175 | value = item.field.get "abc" | ||
176 | if value | ||
177 | switch value\get! | ||
178 | when 123 | ||
179 | return false | ||
180 | when 456 | ||
181 | -- prevent implicit return for next line | ||
182 | handle item | ||
183 | |||
184 | HttpServer\post "/login", (req): success: false -> | ||
185 | switch req when {:name, :pwd} | ||
186 | if name ~= "" | ||
187 | if user := DB\queryUser name, pwd | ||
188 | if user.status == "available" | ||
189 | return success: true | ||
190 | |||
191 | check = (num) -> return num | ||
192 | -- func without implicit return | ||
193 | func = (): -> check 123 | ||
194 | print func! -- get nil | ||
195 | |||
161 | nil | 196 | nil |