Comp 110 Number

Numbers

What is it?

Exactly what you'd expect -- a number! This data type encompasses integers as well as other real numbers with decimals.

Fun fact: in other lower-level programming languages, like C and Java, numbers are split into integers and non-integers!

How do we use number as a data type in TypeScript?

We use the number keyword to tell our program the type of variable we're creating.

let levelOfFun: number = 10;
function feedMeNumbers (a: number, b: number): void {
    // code here
}