Allow match
to use the continue
keyword to allow for a switch
-like continuation
#9009
Labels
match
to use the continue
keyword to allow for a switch
-like continuation
#9009
Describe the project you are working on
Just a GDScript feature request.
Describe the problem or limitation you are having in your project
match
is a replacement forswitch
from other langauges. It is a much easier syntax for most of what people useswitch
for. It however doesn't allow some niche functionality that exists inswitch
, like triggering multiple code blocks for a single switch/match.Describe the feature / enhancement and how it helps to overcome the problem or limitation
It allows a single match statement to have multiple effects without nesting match statements.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Currently godot only match the age value. But with a continue, he could match age and then continue to match color. It has the opposite effect of a
break
withinswitch
. Or a similar effect as acontinue
in anfor
loop.Without the continue line, the statement would output this:
With the continue line and langauge support, it could output:
If this enhancement will not be used often, can it be worked around with a few lines of script?
It's a GDScript language feature. It can't easily be implemented with GDScript.
A similar effect would be difficult to manage without a nested match statement or similar control logic.
Is there a reason why this should be core and not an add-on in the asset library?
It's a GDScript language feature.
The text was updated successfully, but these errors were encountered: