Hi
I am new to C#, I just finished watching a part of a tutorial. I am confused about a line of code, which I did not understand. here is the code,
- int userValue = 2;
- string message = (userValue == 1) ? "boat" : "car";
- Console.WriteLine("{1} - {0}", userValue, message);
- Console.ReadLine();
output: car - 2
my question is for line 3. why its print "car" first? shouldn't it be "2" first?
because it says here
Console.WriteLine("{1} - {0}", userValue, message);
doesn't it mean {1} assign to 'userValue' & {0} assign to 'message'?
I am really confused here.
I am sorry if I post this question in wrong section.
thanks
Shumon