https://www.tutorialspoint.com/swift/swift_data_types.htm
Type Aliases: You can create a new name for an existing type using typealias
Ex:
typealias Feet = Int
var distance: Feet = 100
print(distance)
Type Safety : Swift 4 is a type-safe language which means if a part of your code expects a String, you can't pass it an Int by mistake.
var varA = 42
varA = "This is hello"
print(varA)
Error: main.swift:2:8: error: cannot assign value of type 'String' to type 'Int'
No comments:
Post a Comment