Guide to the Godot game engine/Static typing
Appearance
Static typing
[edit | edit source]Many programming languages are static. For GDScript, it's entirely optional. Here you will learn how to make your code safer and use static typing.
Staticly typed functions
[edit | edit source]Do not confuse this for static functions.
->void
tells Godot the function returns nothing.
-> <type>
tells Godot that the function returns <type>. This can be any Object, or any variable type.
Use nothing to hint the function can return anything.
Arguments can also be made static: argument: <type>
Statically typed variables
[edit | edit source]var variable: <type> = <something or null>
simple. That's it.
You can also use var variable := <something>
to automatically use whatever "something" is.