0
Why is the code without quotations and {0} ,{1}
why is console.writeline (x+y); written without quotations and why it is not like that ("{0}+ {1}" ,x,y);
2 odpowiedzi
+ 1
If the value for the line isn't a string, there is no need for the {0} and {1}. You only need those two for string values.
No string: (x+y); the output is the sum of the two integers
String: ("{0}+{1}", x,y); the output is a line of text that says (x+y)
If you have any question about my answer just comment.
0
In C#, integers can be manipulated with strings. So, if you need to print an integer, you can call Console.WriteLine() on that integer, and it will convert the number in a string automatically.