📜  := 和 = 在 gdscript - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:16.096000             🧑  作者: Mango

代码示例1
//Got it! := may be used in the line declaring a variable to set its type.
//This works:
var a = 3
a = "hello"
print(a)

//This does not:
var a := 3 // a is now typed as int, same as var a:int = 3
a = "hello" // Parser Error: The assigned value's type (String) doesn't match the variable's type (int).