Data Types In Swift
Data Types in Swift Swift is a statically typed language, meaning every variable and constant must have a specific type assigned to it. Here are some commonly used data types in Swift: 1. Integers (Int): Represents whole numbers, both positive and negative. Sizes: Int8, Int16, Int32, Int64 (platform-dependent). Example: let age: Int = 30 2. Floating Point Numbers (Float and Double): Represents numbers with fractional components. Float: 32bit floating-point number. Double: 64bit floating-point number, with higher precision than Float. Example: swift code let pi: Float = 3.14 let gravity: Double = 9.81 3. Strings (String): Represents a sequence of characters. Enclosed in double quotes ("). Example: let name: String ...