JoC #30: Introduction to loops

      Whatever begins, also ends.
            — Seneca
      (Seneca obviously didn’t know about getting your loop condition wrong …  — mik)

Today, we are introducing a new concept: loops. Or, if you want to know more precisely: the while loop.

But, as always, we’re not doing this by just talking about the theory in a vacuum – we actually need it to progress with one of our projects, the Breakout game that we have seen before.

Loops are a concept fundamental to all programming, so if you are a learner, pay close attention. You will need this again later!

Download video

Concepts discussedloops, while loop

Download: breakout-v4.zip

11 thoughts on “JoC #30: Introduction to loops

  1. Thanks again sir!

    Your contributions to Java and students like myself are invaluable!!!
    Fantastic series and teachings. Greenfoot has come alive for me with these series.

    Thank You!

  2. Great videos, Mik. You covered a lot of important stuff, and as usual, you made it clear and fun. It took me a while to get to these two new vids ’cause the two before scared me; the casting issues befuddled me.
    It looks like you will be covering MY question next, which is obstacles( the paddles ). My game is in a room that looks 3D. The player can walk through , but not on the walls and furniture.
    Keep up the great work. In my Java class, everybody loves your shows.
    I saw that some people do this with arrays as in maze games.

  3. hmm, mik is building tension before his next post, here is a little ascii chart showing number of days between JoC episodes starting from episode 8 till 30 (teacher commentary included), 47 days from his last post is a record

    darek

    1 #
    4 ####
    2 ##
    1 #
    2 ##
    1 #
    1 #
    17 #################
    7 #######
    21 #####################
    2 ##
    3 ###
    1 #
    1 #
    0
    3 ###
    5 #####
    5 #####
    1 #
    8 ########
    0
    18 ##################
    6 ######
    47 ###############################################

  4. Love the series – and its very useful. I did a Java course but this is great way to keep improving.
    One question though … why the while loop? Wouldn’t the for loop be a more … typical loop for this? Kind of like with 2D arrays you use a nested for loop to go through them. (As you might have guessed I started with c++. 😀 )

Leave a Reply

Your email address will not be published. Required fields are marked *