#Idioms for conditional continues / breaks?

1 messages · Page 1 of 1 (latest)

jagged crown
#

I find myself using maps to access components in for loops, though I am unable to use an idiom like or_return because I need to either continue or break from the loop when the ok value is false. It forces me to write out the ok value and then check if it's false, though this could be resolved and made more consistent with the rest of the language by introducing or_continue and or_break

#

Patterns for conditional continues / breaks?

#

Idioms for conditional continues / breaks?

rich crag
#

currently there is no or_continue equivalent

wheat dove
#

Yeah - I've wondered too about a more general version of this, but or_continue would certainly cover a decent chunk of cases.

rich crag
#

My biggest issue against or_continue are named branches and or_continue is an expression.

#

This would be valid code and would be terrifying:

x := foo() or_continue loop.x

which would be equivalent to this:

x := (foo() or_continue loop).x