Recap of Floating Point Numbers
What We’ve Covered So Far
Floating point number variables (also called floats) are used when you need a number with a decimal point in it.
Declaring a float variable:
float moo; // declaring a float variable named foo
Changing a float variable:
moo = 21.3;
Declaring and assigning a float variable at the same time:
float moo = 0.955; // declaring a float named moo with a value of zero point nine five five
Doing math with a float variable is just like doing regular math with a variable in Algebra.
Sometimes float variables create what a rounding error, so use integers whenever you can.
Next Step:
You will often need to work with more than numbers. Sometimes you need to write text. For that, you will need to learn about characters: