diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-12-07 23:49:48 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-12-07 23:55:16 +0800 |
| commit | 514b9f97febe8920a78d6078b092fe84b859a963 (patch) | |
| tree | 8c76ba7579f69db7e2c899e4713009b910e0fa89 /spec/inputs/cond.yue | |
| parent | a1d719e3bbfe8cd39c05d2a8f49143b9e814f876 (diff) | |
| download | yuescript-514b9f97febe8920a78d6078b092fe84b859a963.tar.gz yuescript-514b9f97febe8920a78d6078b092fe84b859a963.tar.bz2 yuescript-514b9f97febe8920a78d6078b092fe84b859a963.zip | |
changed the if-assignment syntax to prevent some errors.v0.21.0
Diffstat (limited to 'spec/inputs/cond.yue')
| -rw-r--r-- | spec/inputs/cond.yue | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue index 5bc6c9b..cce96df 100644 --- a/spec/inputs/cond.yue +++ b/spec/inputs/cond.yue | |||
| @@ -52,18 +52,18 @@ elseif "just us" | |||
| 52 | 52 | ||
| 53 | -- | 53 | -- |
| 54 | 54 | ||
| 55 | if something = 10 | 55 | if something := 10 |
| 56 | print something | 56 | print something |
| 57 | else | 57 | else |
| 58 | print "else" | 58 | print "else" |
| 59 | 59 | ||
| 60 | hello = if something = 10 | 60 | hello = if something := 10 |
| 61 | print something | 61 | print something |
| 62 | else | 62 | else |
| 63 | print "else" | 63 | print "else" |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | hello = 5 + if something = 10 | 66 | hello = 5 + if something := 10 |
| 67 | print something | 67 | print something |
| 68 | 68 | ||
| 69 | --- | 69 | --- |
| @@ -72,9 +72,9 @@ z = false | |||
| 72 | 72 | ||
| 73 | _ = if false | 73 | _ = if false |
| 74 | one | 74 | one |
| 75 | elseif x = true | 75 | elseif x := true |
| 76 | two | 76 | two |
| 77 | elseif z = true | 77 | elseif z := true |
| 78 | three | 78 | three |
| 79 | else | 79 | else |
| 80 | four | 80 | four |
| @@ -82,17 +82,17 @@ else | |||
| 82 | 82 | ||
| 83 | out = if false | 83 | out = if false |
| 84 | one | 84 | one |
| 85 | elseif x = true | 85 | elseif x := true |
| 86 | two | 86 | two |
| 87 | elseif z = true | 87 | elseif z := true |
| 88 | three | 88 | three |
| 89 | else | 89 | else |
| 90 | four | 90 | four |
| 91 | 91 | ||
| 92 | kzy = -> | 92 | kzy = -> |
| 93 | if something = true | 93 | if something := true |
| 94 | 1 | 94 | 1 |
| 95 | elseif another = false | 95 | elseif another := false |
| 96 | 2 | 96 | 2 |
| 97 | 97 | ||
| 98 | --- | 98 | --- |
| @@ -152,7 +152,7 @@ dddd = {1,2,3} unless value | |||
| 152 | 152 | ||
| 153 | do | 153 | do |
| 154 | j = 100 | 154 | j = 100 |
| 155 | unless j = hi! | 155 | unless j := hi! |
| 156 | error "not j!" | 156 | error "not j!" |
| 157 | 157 | ||
| 158 | ---------------- | 158 | ---------------- |
| @@ -200,22 +200,22 @@ do | |||
| 200 | elseif c | 200 | elseif c |
| 201 | d: e = tb | 201 | d: e = tb |
| 202 | 202 | ||
| 203 | if :pi = math | 203 | if :pi := math |
| 204 | print pi | 204 | print pi |
| 205 | 205 | ||
| 206 | do | 206 | do |
| 207 | local math | 207 | local math |
| 208 | if :pi = math | 208 | if :pi := math |
| 209 | print pi | 209 | print pi |
| 210 | 210 | ||
| 211 | do | 211 | do |
| 212 | if _M = {} | 212 | if _M := {} |
| 213 | :Thing = _M | 213 | :Thing = _M |
| 214 | :a, :b = _M | 214 | :a, :b = _M |
| 215 | 215 | ||
| 216 | do | 216 | do |
| 217 | global _M | 217 | global _M |
| 218 | if _M = {} | 218 | if _M := {} |
| 219 | :Thing = _M | 219 | :Thing = _M |
| 220 | :a, :b = _M | 220 | :a, :b = _M |
| 221 | 221 | ||
