Using "var" for parameter in func definition

DaveTheCoderDaveTheCoder Posts: 237Member
edited January 25 in Programming

A tutorial that's a couple of years old uses "var" in func definitions. For example:

func do_something(var player: Node) -> void:

instead of:

func do_something(player: Node) -> void:

Is there any advantage in doing that?


Tags :

Best Answer

  • TwistedTwiglegTwistedTwigleg Posts: 4,292
    Accepted Answer

    I think it's the same under the hood, so I do not think it should make a difference either way. I think the version without var is technically the more GDScript way of doing it now, but I think internally the var gets added by the interpreter.

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 4,292Admin
    Accepted Answer

    I think it's the same under the hood, so I do not think it should make a difference either way. I think the version without var is technically the more GDScript way of doing it now, but I think internally the var gets added by the interpreter.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file