formatted string | SoloLearn: Learn to code for FREE!

0

formatted string

Console.WriteLine("x = {0}; y = {1}", x, y); What is the meaning of {0}... in the sentence?

4/6/2020 2:12:39 PM

Harish Adapureddi

2 Answers

New Answer

+3

Harish Adapureddi, {0} points to the 1st variable after you immediately close the quotes(i.e., x) {1} points to the 2nd variable after you immediately close the quotes(i.e., y) These are quiet similar with indexing…

+1

See https://docs.microsoft.com/en-us/dotnet/api/system.console.writeline?view=netframework-4.8#System_Console_WriteLine_System_String_System_Object_System_Object_System_Object_System_Object_