Learn
Numbers are the original data type. The earliest computers communicated only in numbers, using binary computation.
We no longer just program using numbers, but numbers still have special properties and are used to do the following:
- Describe — numbers are used to express value: what is the frequency of a sound wave? We can express that in a number, such as 800hz.
- Calculate — numbers are used in calculations: what’s the distance between the earth and mars?
- Count — numbers are used to keep track: how many times did the car go around the track?
While we can do a lot of things with numbers, there are a few things we can’t do with them. For example, say we have the number 20 and the text, “I am 20 years old.” While both deal with the idea of 20 as a value, a computer could perform mathematical operations on the first piece of data, but not on the second.
Instructions
Numbers allows us to write programs that store values, count, and make calculations. This program calculates the numerical distance between different points in space and keeps count of how far we’ve gone!
Sign up to start coding
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.