0
I just started programming from scratch. Can somebody explain this line of code: Console.Write(someNums[k, j]+" ");
I just started learning and honestly after 8 years of gap from this field, I'm feeling very confident about the basics using Solo Learn. Thank you developers. But, even then, there are still minor things which sololearn forgets to explain or clarify. Such as this statement which are used often in many block of codes without line by line code execution.. Console.Write(someNums[k, j]+" "); Can anyone please explain to me with examples in line by line comments. shaikabdullahshahalam@gmail.com
2 Respostas
0
someNums[k , j] is a two dimensional Array. You can imagine it like an Excel table.
xxxx
xxxx
xxxx
k -> number of row
j -> number of column
So wie consider "someNums" look like this
2 4 7 8
1 9 0 3
8 7 5 2
This would mean "someNums[1,2]" would be the number "9".
Now what does Console.Write(someNums[k,j] + " "); ?
The Write method writes to the console without jumping to a new line. "someNums" outputs a number and the +" " creates a whitespace between those numbers.
I guess in the lesson they used two for-loops, one for "k" and one for "j".
This will loop through your Array and write all numbers from the array to the console.
Output with the array i used before would be:
"2 4 7 8 1 9 0 3 8 7 5 2"
0
thank you. even after syhdyibg continously for so many days, I still wasn't able to understand such a simple thing, unless you pointed it out. eventhough I already used it in a program.. my biggest weakness in programming is to retain the memory of the functions used. anyways, thank you very mucb.