You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letx=Json{ghost: "spooky"};iflety=x.tryAsBool(){log("it's a boolean!");}eliflety=x.tryAsNum(){log("it's a number!");}else{log("it's something else!");}
Use Cases
Checking and unwrapping values without separate if statements
Implementation Notes
No response
Component
Compiler
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
The text was updated successfully, but these errors were encountered:
I think this helps point out the strangeness/inconsistency of having elif instead of else if. I know consistency here would help me personally remember the control flow syntax because it's just logical combinations of three keywords rather than having a fourth one that you use sometimes:
iflet y = x.tryAsBool(){log("it's a boolean!");} elif let y = x.tryAsNum(){log("it's a number!");}else{
log("it's something else!");}
vs
iflet y = x.tryAsBool(){log("it's a boolean!");}elseiflet y = x.tryAsNum(){log("it's a number!");}else{log("it's something else!");}
Feature Spec
Support
if let
in the "elif" position:Use Cases
Checking and unwrapping values without separate if statements
Implementation Notes
No response
Component
Compiler
Community Notes
The text was updated successfully, but these errors were encountered: