Wednesday, December 19, 2012

Arrays and Loops

I find arrays fun to work through once you decipher whats going on and the patterns created within them (for 2D arrays). However, I feel that arrays and 2d arrays are essentially the same exact thing except that 2d arrays add rows to the mix and need a tiny bit more code ( i.e. an extra pair of brackets [ ]). So my question is why are arrays taught as a separate class instead of being part of the 2d array lecture, and why do we even need to have arrays when 2d arrays can do the exact same things as far as I can tell.

Also, I find myself having trouble writing loops. I can understand them when I'm reading the code, but starting from scratch I never know where to begin or where its appropriate to use them. When do you want to use a for loop compared to a while or if loop?

No comments:

Post a Comment