You must set the data type in the variable declaration.
var value: Double = 33
But you can also do it like this:
var value: Double value = 33
Defining it as var will make the variable mutable, so after defining you can change the value
value = 33.2 value = 46.1
If you define a constant or variable that does not need to be changed, you best define it like this:
let value: Double = 33.2
If you need this to be Int for any reason at some point, you can pass it to a function or define it like this:
let intValue = Int(value)
source share