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);

25th Mar 2017, 2:29 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar
2 Respostas
+ 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.
30th Mar 2017, 6:32 PM
DarrnyH
DarrnyH - avatar
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.
25th Mar 2017, 2:38 PM
reddylopes
reddylopes - avatar