0
C# float
“Literal of type double cannot be implicitly converted to type 'float'; use an 'F' suffix to create a literal of this type” What is this error? Sono arrivato alla lezione 18 ma SoloLearn non mi ha ancora spiegato come fare il float.
1 Antwort
+ 4
if you use
var x = 42.0
the default behavior in c# is to consider it as a double. If you want a float, you use
float x = 42.0
or
var x = 42.0f
or
var x = 42f