Interpolation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Interpolation

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

28th Mar 2020, 3:20 AM
Tyler Paul
Tyler Paul - avatar
1 Answer
+ 3
Under the curlybraces {0} or {1} simbolize the order of the value which have to be presented. In your case x in the first order so y will be printed after the x. For more if you do something like this. int n=1; int x=2; int y=3; int z=4; Console.WriteLine("{3} {2} {1} {0}",n,x,y,z); // This will print backwards 4 3 2 1 Where n comes in fourth,x comes in third and that's all. Hope you get it.
28th Mar 2020, 4:38 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar