Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
Last active February 6, 2023 13:44
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 22 You must be signed in to fork a gist
  • Save udacityandroid/03774486d065d2302e33 to your computer and use it in GitHub Desktop.
Save udacityandroid/03774486d065d2302e33 to your computer and use it in GitHub Desktop.
Android for Beginners : If/Else Weather Quiz
boolean isRaining = false;
Log.v("WeatherActivity", "Thank you for using the WhetherWeather App.");
if (isRaining) {
Log.v("WeatherActivity", "It's raining, better bring an umbrella.");
} else {
Log.v("WeatherActivity", "It's unlikely to rain.");
}
@abdobasha2004
Copy link

C

@teebonez28
Copy link

Please stop being so mean to others. I get that people don't always want to see the answers, but it could be said differently. Kindness goes a long way!

@prbehere93
Copy link

A question, if the control statement is changed such that,
boolean isRaining = false;
Log.v("WeatherActivity", "Thank you for using the WhetherWeather App.");
if (isRaining==false) {
Log.v("WeatherActivity", "It's raining, better bring an umbrella.");
} else {
Log.v("WeatherActivity", "It's unlikely to rain.");
}

Will the statement inside 'if' be executed or will it give some kind of error?

@shoooka
Copy link

shoooka commented May 15, 2018

interesting

@Eduese
Copy link

Eduese commented May 28, 2018

Okay, this is similar to the example in the video. Let me go back to answer my quiz

@JacquesInnocent
Copy link

Let me just ran back to the video and submit my right answer LOL

@dennismichael796
Copy link

thats interesting

@Fury4hwxc
Copy link

thanks 👍

@djalilo24
Copy link

C

@YassineOuardini
Copy link

Question C Because isRaining is false, though, it will print the Else Statement to the logs, which is "It's unlikely to rain".

@YassineOuardini
Copy link

Question C Because isRaining is false, though, it will print the Else Statement to the logs, which is "It's unlikely to rain".

@Dexaan
Copy link

Dexaan commented Jul 22, 2019

boolean isRainingInVancouver = true;

@ElikplimSunu
Copy link

Wow we've come a really long way :)

@Ali-FF
Copy link

Ali-FF commented May 29, 2020

let's do this course together mail me at izaneqwan@gmail.com

@allouane
Copy link

allouane commented Jun 4, 2020

It's unlikely to rain. because the isRaining boolean is false

@pro-coder-fast
Copy link

Thank you for using the WhetherWeather App.

@pro-coder-fast
Copy link

It's unlikely to rain.

@mixspark
Copy link

all right

@Harriskobia
Copy link

V/WeatherActivity : Thankyou for using the WhetherWeather App.
V/WeatherActivity : It's unlikely to rain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment