When to use : versus =

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By creed2868

I’m trying to make it so that an enemy follows the player character and all of the tutorials I find use the phrase;

var player : Player

(which is also causing an issue because Player is not a valid type)

I would like to know when I would use : over =. An answer for how to name a specific node would be appreciated as well.


:bust_in_silhouette: Reply From: Schweini

A : is used when you want to define the type of a variable, see also: Static typing in GDScript — Godot Engine (3.2) documentation in English
It is not used as alternative to =. |
The best you can do before I say something wrong is: Read the Docs :wink: |