in second one , why is that "(x = {0} , y = {1} ); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

in second one , why is that "(x = {0} , y = {1} );

please help me understand

13th Oct 2016, 12:14 AM
aman pushpa
aman pushpa - avatar
2 Answers
+ 4
Console.Write("I am {0}, and my age is {1}, {2}", name, age, greeting); // The {x} is a place holder for a variable. It's just another way instead of using "I am + name + ", and my... // And as the rules follows, the first index = 0, second = 1, third = 2, etc... etc...
13th Oct 2016, 8:06 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
+ 1
Console.WriteLine("x={0} y={1}",5,10); // it's print x=5 y=10 0 inside the curly brace is value after ", and so on.
13th Oct 2016, 6:43 AM
Jamaltheen S
Jamaltheen S - avatar