What's the difference between '=' and ':=' ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Krasapan
var save = File.new()


var save := File.new()

What’s the difference? As for me, they works alike

:bust_in_silhouette: Reply From: ichster

:= implicitly sets the type of the variant to that of the assigned value. In this instance, the variant save would become type File when using :=, and directly inferred as such by the compiler. When using just = I think the type of save remains a variant.

A duplicate and more nuanced version of this question is here: https://forum.godotengine.org/85433/difference-between-equals-and-colon-equals