Optionals in Swift
Swift has a feature called Optionals, which allow variables to have a value or to be nil (null). You can use the ? symbol to declare an optional variable.
swift
var myOptional: String?
myOptional = "Hello, World!"
print(myOptional) // Optional("Hello, World!")
No comments:
Post a Comment