when would you use this? C# | Sololearn: Learn to code for FREE!

0

when would you use this? C#

I just started learning C# yesterday and I left off at the console playground. it teaches you that when typing: static void Main(string[] args) { int x = 10; double y = 20; Console.WriteLine("x = {0}; y = {1}", x, y); } // Output: x = 10; y = 20 you will output x = 10; y = 20. I have played with this a bit and got: Console.WriteLine("{0} {1}", x, y); and it types out 10 20. when would you use this?

7/7/2020 1:10:21 PM

Samuel Payne

1 Answer

New Answer

+3

String formating is a succinct syntax, to shorten the old syntax such as "The variable is " + variable.