English subtitles

← 25a s Different Behavior Based On Certain Condition- Weather Quiz

Get Embed Code
13 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. I'll be going over these
    answers pretty quickly, but
  2. we're going to go into more detail
    about if else statements after that.
  3. For this code snippet in
    the weatherActivity.java file,
  4. we create a boolean that's called
    isRaining and we initialize it to false.
  5. Then we go to the next line of code,
    which prints out a log statement
  6. that says, thank you for
    using the weather weather app.
  7. Then we have an if else statement.
  8. If the isRaining boolean is true,
  9. then we should run the code in between
    these opening and closing braces.
  10. Otherwise if the isRaining
    boolean is false,
  11. then we should do the code inside
    these opening and closing braces.
  12. Since isRaining is actually false,
    as shown up here,
  13. then we skip this if condition and
    go all the way down to this else case.
  14. Within this else block of code,
  15. we have one log message that
    prints It's unlikely to rain.
  16. Reading through all of this code,
    it should say, Thank you for
  17. using the whetherweather App.
  18. And then it should skip down to here and
    say, It's unlikely to rain.
  19. That leads us to answer C.
  20. Continue on for more practice.