Skip to main content

Using an [If then else] Block

Now that the Boolean variable has been created and added to the project, an [If then else] block is needed to determine if a green disk has already been picked up and placed in the drop off location.

  1. Add an [If then else] block from the ‘Control’ category to the ‘Determine if green disk was already placed’ [Comment] block.

    Add if then else block
  2. Reorganize the comments to highlight the two options - if a green disk was already placed, and if it is the first green disk. Select the ‘If the first green disk…’ comment and move the three comments total to the ‘else’ branch of the [If then else] block.

    Reorganize comments
  3. Since the [If then else] is being used to determine if a green disk has already been placed, select the ‘greenDisk’ Boolean variable and place it as the parameter in the [If then else] block.

    Add greenDisk boolean to parameter