Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 2.13 Short-Circuit Evaluation

Description

This lesson introduces Short-Circuit Evaluations. In a Short-Circuit Evaluation, if the result of a Boolean Expression can be determined by the first argument, the second argument is not evaluated.


Objective

Students will be able to…

  • Explain what short circuit evaluation is
  • Explain why short circuit evaluation is useful
  • Identify situations where Java will use short circuit evaluation when running a program
  • Create programs that use short circuit evaluation to prevent crashing