+ 1

explain this code and result

static void Main(string[] args) { int x = 10; double y = 20; Console.WriteLine("x = {0}; y = {1}", x, y); } // Output: x = 10; y = 20

24th Feb 2019, 12:58 PM
Venkata kalyan chakravarthi sanagapalli
Venkata kalyan chakravarthi sanagapalli - avatar
2 odpowiedzi
+ 1
{} and {} seem to be placeholders for the variables that are inserted, and 0 and 1 the indexes of the variables in the order they follow.
24th Feb 2019, 1:12 PM
HonFu
HonFu - avatar
+ 1
HonFu That is true. {} Are placeholders. That is the way c# can print the values of its variables.
24th Feb 2019, 3:00 PM
sneeze
sneeze - avatar