Mission log 4.
Type Annotation
Type annotation let us state what data type we want for our variable and constant.
example:
var name: String = "Opeyemi"
Type inference is when swift is able to figure out the data type of a variable or constants, based on value we assign.
example:
var name = "John Doe"
From the snippet above , swift will infer the data type to be String, because we assign text value to the variable.
Top comments (0)