C#C
C#4mo ago
Git Racc

✅ Beginner question about formatting

Hey all! I'm learning the basics and struggling a bit to understand why the second picture correctly displays the message.
While trying to format the output text I also tried to do:
  • Console.WriteLine($"Celsius conversion: " + {celsius:F1} + " Celsius.");
and it obv resulted in some kind of syntax error.
Can someone help me understand why the bold example and the first picture's code didn't work?
Also, prettty strange that the module didn't really explain the {celsius:F1} thing
image.png
image.png
Was this page helpful?