Replies: 1 comment 5 replies
-
I do have plans to add if-else support (as well as switch #586). But I do plan to make if-else as expressions: let foo = if cond1 {
"success"
} else if cond2 {
"alternative"
} else {
"failure"
} Even early returns: if age < 3 {
return false
}
if age < 10 {
return false
}
true // User is mature enough to by a ticket. But no variables reassignments. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Any plans of adding
if-else
chain with the option of returning a value for every condition, for e.g.:Relying on ternary operator for this becomes slightly clumsy. Also, early returns when a check passes/fails would also help.
Thanks,
Rohan Chougule
Beta Was this translation helpful? Give feedback.
All reactions