Dictu icon indicating copy to clipboard operation
Dictu copied to clipboard

[FEATURE] Support break for switch statements

Open RevengerWizard opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem?

The current implementation of switch statements doesn't really support the ability to break out of it.

Describe the solution you'd like

I'm not really sure how this could be achieved, perhaps by treating the switch statement like a loop?

Describe alternatives you've considered

Similar behaviour could still be achieved by putting the switch statement in a function and just do a return, but it would still be nice to have this other possibility for breaking out of a switch statement.

Additional context

No response

RevengerWizard avatar Nov 25 '22 15:11 RevengerWizard

Hey! Sorry it took me so long to respond to this. I'm actually unsure how I feel about switch statements altogether if I'm being perfectly honest. There are other ways to achieve the same output without using the switch statement. Something to think about going forward with Dictu if I'm honest, we could remove them entirely and try to opt for something a little more powerful with match statements (although this may need some compiler re-jig as .match is used a bit for dealing with Result types).

Definitely a valid gripe if we are to keep switch statements in the language however!

Jason2605 avatar Jan 03 '23 19:01 Jason2605