Early return operator #3514
Labels
Language
Regarding Squiggle language semantics, distributions and function registry
stage:design
Needs more work to describe how it would work
Discussed here: https://eaforecasting.slack.com/archives/C030T49UHSS/p1737486831253379
Long nested ifs in FP can get ugly.
I wonder if we could add some syntax for early returns, and keep the rest of Squiggle functional.
->
One downside, as we discussed, is that this feature is pretty unique, i.e. I can't find any FP languages that have this.
On
returnif [condition] then [expression]
:if ... then return ...
would be more complicated, because the entire construct is not an expression, but a statementreturn [expression] if [condition]
? (I think I prefer the condition -> expression order though)The text was updated successfully, but these errors were encountered: