bootcamper bootcamper SetUp Docs Reps Blog
bootcamper bootcamper

U2L10 - else if

This lesson drills what Trevor teaches in U2L10

Pre-requirements:

  • You have performed each of previous drills to reach a top speed, and then repeated top speed 10x
  • Follow this for all drills explainer
  • Or this if you haven't even installed the drills yet installation

Summary of what is drilled

A Disciplined Approach? holds that these items should never again allow any confusion in your mind about this list of what Trevor covered in this lesson:

COVERED IN THE LESSON

  • can have an if without an else
  • can have an if(){}else if(){} else {}
  • only an expression that yields a boolean can be used in an if
  • an assignment is NOT an expression that yields a boolean ie age=12
  • == does not work with String comparisons
  • nested if statements

Instructor Administered Test

  • Create a new project
  • Create a new package
  • Create a new class with a new public static void main method
  • declare and assign an int variable named attitude of 8

write code that prints

  • if you have an attitude of higher than 7 then you will persist,
  • else if it is greater than 5 you will stay positive,
  • else if greater than 3 you will at least smile
  • else you might give up,
  • but either way you can learn from your experience.