Optionals in Swift

Optionals in Swift are used to represent absence of value. When a value is of optional type, it either has a value or no value at all(nil). When a value is declared to be optional, automatically its value will be assigned as nil. Except for optional type no other type can be assigned with nil value.

 

 

 

Leave a Reply