Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 596 Bytes

File metadata and controls

16 lines (12 loc) · 596 Bytes

Large number separators

In Swift, you can use underscores as thousand separators in numeric literals to make them more readable. It's like giving your numbers a quick makeover for clarity! This feature is not just a pretty face; it helps prevent silly mistakes when dealing with large numbers. No more misplaced zeros leading you astray!

// km to the moon
let distanceToMoon = 384_400_000
 // Pi with style
let pi = 3.141_592_653_589
/// Binary, but fashionable
let binaryExample = 0b0010_1010 

Reference

YouTube 👀