-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow match
to use the continue
keyword to allow for a switch
-like continuation
#9009
Comments
match
to use the continue
keyword to allow for a switch
-like continuation.match
to use the continue
keyword to allow for a switch
-like continuation
I flipped through some old proposals, and launched Godot3 again for the first time in a while. Looks like this WAS a feature in Godot3. The above code works as expected unchanged in Godot3.5.3. |
If we want to add something like this, then it should be a separate keyword, not |
How about allowing another keyword to specify:
It might be useful in nseted loops, and |
I think Unless we find a really good alternative, IMHO, it would cause more confusion than it's worth. I'm really not a fan of two word solutions.
|
|
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: