Chapter 4. Numbers
Numbers are the fundamental language of computers. They are also a staple of software development. Numbers are used to keep track of temperature, count the letters in a sentence, and track the number of zombies infesting a town. Numbers come in two basic flavors: integers and floating-point numbers.
Integers
You have worked with integers already, but we have not yet defined them. An integer is a number that does not have a decimal point or fractional component – a whole number. Integers are frequently used to represent a count of “things,” such as the number of pages in a book.
A difference between integers used by computers and numbers you use elsewhere is that an integer type on a computer takes up a fixed amount of memory. ...
Get Swift Programming: The Big Nerd Ranch Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.