It doesn't work if we use only if-condition. Why so?

2 Answers 2


Kareem has the right answer (as usual), per your example, if you did not use a forever loop, the cat would check if it was being petted once after you click the green flag, and see that you are not touching it that very moment, and stop checking. The forever loop makes it stay checking.

  • To see this in action, put in a "say" statement in the forever loop to see it constantly checking the condition. Then implement it without the forever loop. It will check once, then be done with it. Mar 4, 2015 at 21:18

An if block/condition is different from a forever block/loop in the sense that a loop, in general, keeps repeating while some condition is true. A forever loop, in particular, as its name suggests keeps repeating forever.

An if condition is only checked once and executed if it is true or not executed otherwise.

  • i know for what it is used. I want to know why it is used in that particular case of pet-the-cat example in Scratch? The program can be implemented without using forever loop. Right? If not, then why? That's my question. Mar 4, 2015 at 11:46
  • @PalashShendre let me ask you first, how do you think it could be implemented without a forever block?
    – kzidane
    Mar 4, 2015 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .