GDScript function parameter default value can be an expression #8465
Labels
area:manual
Issues and PRs related to the Manual/Tutorials section of the documentation
enhancement
topic:gdscript
Your Godot version:
4.2 built from the repo on linux
Issue description:
In the GDScript reference basics page the functions section briefly mentions that function definitions can have typed and optional parameters. What it omits is it can also use an expression as the default value of a parameter. Specifically, another parameter can be referenced as the default value.
I am not sure if there are restrictions in the expressions used as a default value, but I have not seen this even mentioned elsewhere in the GDScript documentation.
As I don't know the breadth of this functionality, I wouldn't be comfortable documenting it, but someone definitely should, as it is really useful.
URL to the documentation page:
https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_basics.html#functions
The text was updated successfully, but these errors were encountered: