C# WriteLine Concatenation Questions
Greetings All, I was playing around with the C# WriteLine Concatenation after Lesson 4.1 of the C# Course. I encountered a few weird observations I cannot understand. For the full code of my practice sheet see: https://code.sololearn.com/cA6a2157A141 First: (Example 5) in code) Console.WriteLine("a = ", a + " ; b = " + b); This gives as output: "a = ". Question: Why doesn't it write beyond the 'a = ', or give an error instead? Note: Console.WriteLine("a = ", + a + " ; b = " + b); gives the same output: why? Second: (Example 6) in code) int x = 3; int y = x++; Console.WriteLine("x = {0}", x + " ; y = " + y); This gives as the correct output: "x = 4 ; y = 3". Questions: Why does this work without the y = {1} placeholder? Why doesn't it skip the y=, the same as the a & b example 5) above? I would be grateful for any help. Thanks in advance, Erwin!