buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.15k stars 31 forks source link

Allow null unwrapping in inline if #169

Closed giann closed 9 months ago

giann commented 10 months ago
str hello = if (value -> unwrapped) unwrapped.lower() else "nothing";
giann commented 9 months ago

We can't handle creating a new local while evaluating an expression. And anyway other tools are available to do this in an expression like:

var value = opt ?? "default";

and

var value = opt as? str;