JoC #5: If statements

    The sooner you fall behind, the more time you’ll have to catch up.
        — (unknown)

Continuing straight on from the last episode, we now make the turtle turn at the edge of the world.

Download video

Concepts discussed: method return value, boolean, if statement

Nothing to download – we continue with the scenario from last time.

 

12 thoughts on “JoC #5: If statements

  1. Chris Jobling

    I like the color coding feature in Greenfoot … it seems to be a very affective way of encouraging the proper nesting of blocks and is also quite affective at pointing out mismatched braces.

  2. Viv Campbell

    This episode carefully explained why it was good to turn in small steps but not why it was possible for the turtle to apparently ignore the move (when it was at the edge of the world) and to carry out the turn. Perhaps a mention of this iin this episode would be helpful – even if it is already covered somewhere else.

  3. mik Post author

    Yes, you’re right, sorry.
    The story is this: Actors cam, by default, not leave the world. If they are at the edge and attempt to move, the move will just hav no effect. (They are just pushing against a wall.)

    So the turtle actually tries to move at every step, but as long as it is facing the edge this has no effect. Once it has turned around sufficiently, the move works again.

  4. Pingback: Joy Of Code #5 – If Statements - Compu2Learn

  5. Doug

    Mik, thanks for these video’s i just started going through them and they are GREAT.

    -Doug

  6. Pingback: El júbilo de programar – Videotutoriales | CyberHades

  7. Alex Oragz

    I have always tried to learn programming and your site is by far the best tutorial i have seen.

    Many thanks!

  8. Aditya Gupta

    I went to the Animal class documentation, but it only shows 1 method, not three. I only showed the void act() method.

  9. Anonymous

    Mine also says that my coding doesnt recognize the (atWorldEdge()) and i have exactly what is on your screen…

Comments are closed.