Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

:= and = in gdscript

//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).
 
PREVIOUS NEXT
Tagged: #gdscript
ADD COMMENT
Topic
Name
8+2 =