O'Reilly logo

Alice 3 Cookbook by Vanesa S. Olsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running conditional code within a counter

In this task, we will include many statements together with an if block into a loop that repeats the execution of the code a specific number of times. Thus, we will evaluate the result of an expression many times within a counter.

Getting ready

We will be working on a project with at least two actors. Therefore, we will use an existing project that has a bee and a red bird.

  1. Open the project saved in the Running conditional code recipe in this chapter.
  2. Click on Edit code and then on the class: MyScene drop-down list. The list of classes that are part of the scene will appear.
  3. Select MyScene | Edit run.
  4. Delete all the existing statements in the run procedure for the MyScene class.

How to do it...

Follow these steps ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required