A lot of students, when they’re first learning to program, are surprised when they’re code doesn’t do what they want. We are going to explore why that is .
Newby programmer trying to write
“hey as long as these two things are false”…do some stuff
hmm… how do we write that. It might actually suprise you. First let’s look at a specific example (that I am taking from a new lesson that we aded Penjee’s and/or logic unit)
Consider the following penjee assignment.
You have Pengun starting on the very top left (Figure 1 above) and you want to write a loop that ends at the fish in column 5 (Figure 2 below)
When your code is run, it should cause the penguin to do the animation below in figure 3:
Here’s the for what we want to write.
begin loop :
while there's no fish here and while there's no fish ahead
The big question that most new programmers can’t answer is :
Do we write the code below :
Or are they the same