0

Why we use x = {0}

but the value of x is 4

25th Jan 2017, 10:00 AM
Usama Nazir
Usama Nazir - avatar
2 ответов
0
We use {0} to substitute which ever is the first variable after your string, and start counting up from 0, so the second variable would be {1}. It simply replaces your {0} to whatever firstName equals, in this case it is John. firstName = "John"; lastName = "Smith"; ConsoleWriteLine("Your first name is {0} and your last name is {1}", firstName, lastName);
17th Mar 2017, 12:30 AM
Marc Nardangeli
Marc Nardangeli - avatar
- 1
{0} means true, so it's like telling your program assign it to x if it's true, according to the condition you gave it
25th Jan 2017, 2:23 PM
Tuchy
Tuchy - avatar