Wednesday, May 25, 2011

While Loops and Dizziness

WHILE loops are computational constructs for repeating a set of instructions while some criteria condition is true. During each iteration of the loop, the program: tests whether the condition is true and, if so, executes the block of code within the loop.


When I was a child, we played a great game called 'Spinning around'. This game was loosely based on the computational construct of a WHILE loop. In fact, legend has it that this game was invented by some of the earliest computational thinkers.


The rules for the game were:


WHILE you are not dizzy

{

    Spin around quickly

}

Throw up or fall down (or both)


I always won. Or, maybe I always lost. Can anyone ever really win that game?

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.