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 Answer
+ 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