You can define the return type of functions, like func foo() -> int: return 42
. And I think I read that this actually helps the GDScript compiler/runtime to generate slightly better code. In addition to other benefits that static typing provides but I am just looking at performance here.
I always define the return type of functions that actually return something but I don't define it for functions that return nothing. So basically at the moment I would write:
func return_fancy_value() -> int:
return 42
func do_nothing():
pass
But I wonder if it actually helps to declare those void functions with -> void
. Does anyone know if this has any positive effect on performance?