By default, a real numeric literal on the right side of the assignment operator is treated as double. Therefore, to initialize a float variable, use the suffix f or F, as in the following example:
Code (C#)
float x = 3.5F;
If you do not use the suffix in the previous declaration, you will get a compilation error because you are trying to store a double value into a float variable.