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:
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.
float moo = 0.955; // declaring a float named moo with a value of zero point nine five five