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.

28th Dec 2022, 8:46 PM
Giovanni Paolo Balestriere
Giovanni Paolo Balestriere - avatar
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
28th Dec 2022, 10:17 PM
Bob_Li
Bob_Li - avatar