True / False Variables
True / False Variables: Bool Variables bool keepLooping; type name
True / False Variables: Bool Variables bool keepLooping; keepLooping = true; while ( keepLooping == true ) { … }
True / False Variables: Bool Variables bool keepLooping; keepLooping = true; while ( keepLooping ) { … }
True / False Variables: Bool Variables bool haveValidInput; haveValidInput = false; while (haveValidInput == false) { … }
True / False Variables: Bool Variables bool haveValidInput; haveValidInput = false; while ( !haveValidInput ) { … }
True / False Variables: Bool Variables bool haveValidInput; haveValidInput = false; while ( !haveValidInput ) { … }
True / False Variables: Bool Variables bool haveValidInput; haveValidInput = false; while ( !haveValidInput ) { … }
Logical Operators: And / Or
Logical Operators: And / Or
Logical Operators: And / Or
Logical Operators: And / Or Example: if ( temp > 32 && temp < 50 ) isChilly = true; if ( temp < 32 || temp > 90 ) yuckyWeather = true;
Your task… New project named bool Write a program that : Asks the user a yes/no question Loops until the user has entered a valid answer Which logical operator do you need to use in the loop condition check? Is this an “and” or an “or” question?
Your task continued… Add to your bool project… Asks the user the yes/no question again Loop until the user has entered a valid answer This time, use a single bool variable as the loop control variable
Clear and Unclear Windows