Swift can use almost any character as a constant and variable name, including Unicode, but cannot contain number symbols, arrows, invalid Unicode, horizontal lines-tabs, and cannot begin with a number.
var π= 3.14
var new air software = " development software "
Let's hello = " Hello World "
The form of shaping
Binary: Prefix 0b
Octal: Prefix 0o
Hex: Prefix 0x
Let decimalinteger =
Let binaryinteger = 0b10001
Let octalinterger = 0o21
Let hexadecimlinteger = 0x11
Let minValue = UInt8. Min
Let maxValue = UInt8. Max
UInt8 is a struct struct
{
Public struct UInt8: unsignedintegertype, comparable, equatable {
public var value:builtin. Int8
// A type that can represent the number of steps between pairs of
// values.
public typealias Distance = Int
// Create An instance initialized to zero.
public init()
// Create An instance initialized to ' value '.
public Init(_ value: UInt8)
public init(_builtinintegerliteral value:builtin. Int2048)
// Create An instance initialized to ' value '.
public init(integerliteral value: UInt8)
public static var max: UInt8 {get}
public static var min: UInt8 {get}
}
type aliases
Typealias Nsinteger = Int
var value: nsinteger =
Value =
Print(value)
Boolean type
var tigerisanimal: Bool = true
Swift Naming conventions