what is the meaning of : {0} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the meaning of : {0}

what is the use of {0} after the word hello if i wanted the program to print hello + username

27th Jun 2016, 11:26 AM
Abdelrhman Mansour
Abdelrhman Mansour - avatar
4 Answers
+ 4
string world = "world!"; Console.WriteLine("Hello {0}", world); // This is the same as Console.WriteLine("Hello " + world); I use the {x} only because it looks more, well, nice.
27th Jun 2016, 12:28 PM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
+ 4
{x} is a place holder, which will be substituted by the variable during execution.
28th Jun 2016, 10:55 AM
Syed Izharullah
Syed Izharullah - avatar
+ 2
its uses to get index from user input values {0} here 0 is index of user input .
29th Jun 2016, 12:32 AM
Safik Rahman
Safik Rahman - avatar
0
it is place holder
10th Jul 2016, 6:11 AM
Anil Bawne
Anil Bawne - avatar