Do you always declare variable types?

Godot Version

4.6

Question

While dynamic casting in Godot allow you to freely use a variable as any type, I personally always declare the variable type I would like to use at all times.

Even in other dynamic programming languages, I never find the need to change variable types at all.

From reading around, you got some performance boost in Godot if you declared the type. The performance gain is quite negligible unless you have a huge amount of processing.

What about you guys? Do you do this?

Yes always, it also helps to get autocomplete from the editor and better error detection.
And i saw perfomance improvements up to ~20%, which i dont think is negligible

Always myself, I’ve even gone as far as setting unTyped variables in the GDScript settings as an error. That way I’m always forced to used typed variables. When everything is explicitly typed there is a noticeable performance boost. I also like to know what my variable types are just by looking..

I don’t usually or I use a mix. In most of my previous coding experience declaring wasn’t a thing so I haven’t really picked up the habit of doing so. If it benefits performance that much I’ll probably start making the effort.