Skip to content

GDScript: support variable definition as condition in if-statement#98538

Open
zjin123 wants to merge 1 commit intogodotengine:masterfrom
zjin123:ifvar
Open

GDScript: support variable definition as condition in if-statement#98538
zjin123 wants to merge 1 commit intogodotengine:masterfrom
zjin123:ifvar

Conversation

@zjin123
Copy link

@zjin123 zjin123 commented Oct 26, 2024

As suggested by @KoBeWi, this PR is separated from #98335. It closes godotengine/godot-proposals#2727 by allowing one variable definition as condition in if-statement (e.g. if var n := foo():).

For discussion of a new syntax for mixing multiple variable definitions and expressions in a single if-statement (e.g. if var n := foo(), n > 100:), please refer to #98335.

@zjin123 zjin123 requested review from a team as code owners October 26, 2024 00:21
@Calinou Calinou added this to the 4.x milestone Oct 26, 2024
@AThousandShips AThousandShips changed the title GDScript: support variable definition as condition in if-statement (godotengine/godot-proposals#2727) GDScript: support variable definition as condition in if-statement Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to define variables inside conditions

2 participants