I just started programming from scratch. Can somebody explain this line of code: Console.Write(someNums[k, j]+" "); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

26th Jul 2017, 1:54 PM
Shaik Abdullah Shah Alam
Shaik Abdullah Shah Alam - avatar
2 Answers
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"
26th Jul 2017, 2:26 PM
A. Berger
A. Berger - avatar
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.
1st Aug 2017, 4:13 PM
Shaik Abdullah Shah Alam
Shaik Abdullah Shah Alam - avatar