+ 1

Didnt understand the second fornatted string code. Console.WriteLine("x = {0}; y = {1}", x, y); Why x & y is 0 & 1?

18th Aug 2017, 12:39 PM
Akhi Jetra
Akhi Jetra - avatar
3 ответов
+ 8
x=0 y=1 Are your values right? Now assume they are in an array [x,y] Thus, array[0]=0, array[1]=1. That is essentially what the braces do. {num} returns the (num+1)th term in the list of arguments given behind. I am bad at explaining :(
18th Aug 2017, 12:44 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Let me see...
18th Aug 2017, 12:40 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
{0} and {1} are placeholders. {0} is the second argument so that would be x and {1} is the third agrument that would be y. Since the value of x and y are not included in your code. I cannot predict your output. Have a look at this code https://code.sololearn.com/c9Sy3XspIEZB/?ref=app
18th Aug 2017, 3:00 PM
sneeze
sneeze - avatar