0
Why we use x = {0}
but the value of x is 4
2 Answers
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);
- 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