Skip to content

Instantly share code, notes, and snippets.

@arslanbilal
Last active August 29, 2015 14:05
Show Gist options
  • Save arslanbilal/595e688f7f9ec9815c34 to your computer and use it in GitHub Desktop.
Save arslanbilal/595e688f7f9ec9815c34 to your computer and use it in GitHub Desktop.
Swift Numeric Literals
let decimalInteger = 17
let binaryInteger = 0b10001 // 17 in binary notation
let octalInteger = 0o21 // 17 in octal notation
let hexadecimalInteger = 0x11 // 17 in hexadecimal notation
let decimalNumber = 1.25e2 // 125.0 e2 means 10^2
let decimalNumber2 = 1.25e-2 // 0.0125 e-2 means 10^-2
let hexadecimalExponent = 0xFp2 // 60.0 means 15x2^2
let hexadecimalExponent2 = 0xFp-2 // 3.75 means 15x2^-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment