Repository navigation
Conditional echos
#5226
ollien
started this conversation in
Ideas & suggestions
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. |
1 reply
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 |
0 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.
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 likeAll reactions