Skip to content

Conversation

@tetrapod00
Copy link
Contributor

@tetrapod00 tetrapod00 commented Aug 20, 2024

Fixes #9786.

Adds an entry for "when" to the table, which links to "match".


As for potential confusion about "pattern guards" vs "guard expressions":

  • In the docs, both phrases only appear on this page.
  • The engine itself has some errors that mention a "pattern guard" with an "expression". The phrase "guard expression" does not appear anywhere in engine error messages.
  • The class reference never mentions "guard expressions" or "pattern guards".

So my impression is that you can create a match statement with a "pattern guard" which has an "expression". And you might call that expression a "guard expression", as the current docs section does. But these seem to be terms that are only implicitly defined in a one place in user-facing content, or perhaps terms from another language that are borrowed directly.

I changed the section header from "Pattern guards" to "Pattern guard expressions" so it can be found with ctrl+f both ways. Not too attached to that change.


I mainly use C#, so a review from a GDScript expert would be appreciated.

@AThousandShips AThousandShips requested a review from a team August 20, 2024 16:10
@AThousandShips AThousandShips added enhancement topic:gdscript area:manual Issues and PRs related to the Manual/Tutorials section of the documentation cherrypick:4.3 labels Aug 20, 2024
@MajorGonzo
Copy link
Contributor

As a new-ish Godot user, I agree that a single term should be used consistently in the documentation. Prevents confusion in us new-comers.

@tetrapod00 tetrapod00 changed the title Add documentation for GDScript "when" statement Document GDScript "when" and clarify pattern guard docs Aug 22, 2024
@tetrapod00 tetrapod00 requested a review from dalexeev August 25, 2024 21:51
@mhilbrunner mhilbrunner merged commit ff66473 into godotengine:master Aug 29, 2024
@mhilbrunner
Copy link
Member

Thanks, merged. And thanks dalexeev for reviewing :)

@tetrapod00 tetrapod00 deleted the gdscript-when branch September 23, 2024 19:38
@mhilbrunner
Copy link
Member

Cherry-picked to 4.3 in #10038.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:gdscript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"when" keyword not listed as a keyword

5 participants