How to negate two things

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.

Figure 1

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)

Figure 2

When your code is run, it should cause the penguin to do the animation below in figure 3:

Figure 3
Figure 3

Here’s the   for what we want to write.

The big question that most new programmers can’t answer is :

Not twice


Do we write  the code below :


Figure 4



Or are they the same

Well, it turns out that they are  not the same thing and that only one of them works at all !

It turns out that the first code set (Figure 4) is the one that correctly says ” Hey as long as 2 things are not true”