0
Why do we use 0 in below statement?
Console.WriteLine("Hello {0}")
3 ответов
+ 1
You are missing the 0-index parameter:
Console.WriteLine("Hello {0}", "John");
Now the above code will output:
Hello John
To expand, you could use:
Console.WriteLine("Hello {0} {1}", "there", "John");
... which would output:
Hello there John
+ 1
+ Console.WriteLine() calls string.Format() which means you can also use it to format strings example: string hw=string.Format("{0} {1}", "Hello", "World");
0
thanks buddy 😊