// INTEGER LITERAL
let decimalInteger = 17 // 17 in decimal notation
let binaryInteger = 0b10001 // 17 in binary notation
let octalInteger = 0o21 // 17 in octal notation
let hexadecimalInteger = 0x11 // 17 in hexadecimal notation
print("First : \(decimalInteger), Second : \(binaryInteger), Third : \(octalInteger), Fourth : \(hexadecimalInteger)");
// FLOAT LITERAL
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecimalDouble = 0xC.3p0
print("First : \(decimalDouble), Second : \(exponentDouble), Third : \(hexadecimalDouble)");
// STRING LITERAL
let stringL = "Hello\tWorld\n\nHello\'Swift\'"
print(stringL)
// BOOL LITERAL
let lightOn = true
print(lightOn)
No comments:
Post a Comment