1.8. Type annotations (revisited)

As we have already discussed a couple of times, we can predefine the data type for a variable when you are creating it. This is called Type annotations.

The general format of type annotations is as follows: let variableName : DataType = value.

A few examples could be:

let myName:String = "Sakib Miazi"
var myAge:Int = 10
let iUseIPhone:Bool = false

Last updated

Was this helpful?