0
doubt in c#
static void Main(string[] args) { int x = 10; double y = 20; Console.WriteLine("x = {0}; y = {1}", x, y); } // Output: x = 10; y = 20 but when i code like this Console.WriteLine("x = {3}; y = {4}", x, y); codeplay ground compiler reports error ,why is it so??.Where you say any place holder can be used.
1 Answer
+ 2
{0} --> here the first variable after the string (in Console.WriteLine) will be inserted, which is x
Correspondingly, {1} refers to y.
{3} and {4} don't work because they refer to nothing