Conditional echos
#5226
Replies: 2 comments 1 reply
-
|
We intend to not add additional flow control features to Gleam, and any new feature to the core language have to be in aid of a large problem in Gleam programming, but this seems very niche and largely about stylistic preference. |
Beta Was this translation helpful? Give feedback.
-
This also came to my mind: fn echo_unless(cond, val) {
case cond {
True -> echo val
False -> val
}
}However the line numbers will be off for this one. Would a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, it's a bit clunky in the language to write conditional
echos. I've often found myself resorting to thisOthers in the Discord have suggested making use of
bool.guard, but it's a bit unintuitive because that requires negating the conditionIt would be great if this could be part of the
echosyntax. Something likeBeta Was this translation helpful? Give feedback.
All reactions