0

why in console.writeline sometime whe put "{0}" followed by a var.

console.writeline( "valor of x:{0}",X);

20th Jul 2016, 3:34 PM
Edward Gilberto Feliz Moreno
Edward Gilberto Feliz Moreno - avatar
7 Respuestas
+ 5
{0}, {1}, {2} and so on are the position in the string where the variables, after comma, is placed in respective way. For example, console.writeline("I got {0} for Maths, {1} for English, and {2} for History", 80, 85, 75) Try fiddling the numeric mark with A, A+, B, etc. Do you get it?
20th Jul 2016, 6:38 PM
Jansen Tanu
Jansen Tanu - avatar
0
It will refer to the first instance of the variable. Think of the comma delimited variables as an index. This way string expressions are greatly simplified.
20th Jul 2016, 4:16 PM
Todd Blackman
Todd Blackman - avatar
0
can you explain mildly... your answer is too cumbersome
20th Jul 2016, 5:49 PM
George Rex
George Rex - avatar
0
there are places holders for the variables .. those are for readable purpose..
23rd Jul 2016, 12:58 PM
Duraichi Veerakumar
- 1
yea now i get it thank u
20th Jul 2016, 6:43 PM
Edward Gilberto Feliz Moreno
Edward Gilberto Feliz Moreno - avatar
- 1
{0} for telling the computer to print the first value of your data
23rd Jul 2016, 5:13 PM
Alexis Steeve VARA
- 1
it kind of output value of variables
25th Jul 2016, 2:13 PM
Abdalrhman Shazally Abdalrhman Alhassan
Abdalrhman Shazally Abdalrhman Alhassan - avatar