Proposal:Why doesn't the match function use the "<.<" symbol for range matching? #12340
Closed
linqiaozhi123
started this conversation in
Scripting
Replies: 0 comments
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.
-
1. Project Description
I am currently developing a numerical simulator using the Godot engine and GDScript. In this simulator, there are various numerical values that need to be checked to determine whether they fall within specific ranges in order to produce different results.
2. Problems or Limitations Encountered in the Project
The match function seems to be overly cumbersome. Usually, a lot of redundant characters have to be written for numerical range matching. Therefore, I came up with the idea of simplifying it.
3. Description of How the Proposal Will Work Using Code, Pseudocode, Models, and/or Diagrams
Old Version:
New Version:
4. Can It Be Solved by a Few Lines of Script if This Enhancement Is Not Frequently Used?
It can be solved with a few lines of script. However, this is syntactic sugar that can speed up game development. For example, in the character combat power and item rarity systems. These systems usually require checking a certain value (such as experience points, skill levels, or item statistics).
Beta Was this translation helpful? Give feedback.
All reactions