My programming class (and my three other classes) have kept me quite busy. I’m learning a lot, but I found, I’m learning a lot of things on my own. We’ve covered control flow statements (if, else if, else, and loops), casting, parsing strings, formatting, and a bunch of other things. For the past two weeks our main focus has been on loops, well…at the very least out last few labs have been all loop related. And I can definitely understand why we’re devoting more time to this. Loops can trip a lot of people up.
Since I’m mostly teaching myself, I’m always looking for additional resources online. Two weeks ago I found a great for loop tutorial through the York College of Pennsylvania. The CS 101 – Lecture 6: For Loops, loops recipes tutorial is written in C#, but it easily translates into Java. To be quite frank I didn’t even notice a difference. The syntax used was almost identical.
What really makes this tutorial special is how it breaks down the loops by type and suggests recipes for you to choose from (depending on what you are trying to accomplish). This loops tutorial also explains how to customize a loop, and plan the iteration. It also provides a sample loop for you to trace and it goes through each iteration of that loop. At the time, I was working on a lab that calculated pi with the Nilakantha series, so I found this tutorial particularly helpful.
Nilakantha Series formula for pi:
π = 3 + 4/ (2*3*4) – 4/(4*5*6) + 4/(6*7*8)- 4(8*9*10) + 4/(10 * 11* 12) – 4(/12*13*14)…
I wanted to share this with you, because this tutorial is pretty straight forward and perfect for anyone who wants to be able to have a better understanding of for loops or how to trace a loop, which I’m finding to be a very necessary and useful skill to have.
Additionally, one of my classmates suggested the website Coding Bat which has coding exercises for both Java and Python. Check it out, it’s totally awsomesauce!
That’s all for now. Have a beautiful weekend! 🙂