asked 39.9k views
0 votes
In a situation where you want to perform one action when a Boolean expression evaluates as true and an alternate action when it evaluates as false, otherwise known as a dual-alternative decision, what sort of statement should you use?

asked
User Pablo CG
by
8.0k points

1 Answer

0 votes

Answer:

if-else

Step-by-step explanation:

Based on the information provided within the question it can be said that the best statement to use in this situation is an if-else statement. Like mentioned, this is a statement that outputs two different results depending on whether or not the input meets a predefined set of rules.

For Example: Input is 17

if (hour < 18) {

greeting = "Good day";

} else {

greeting = "Good evening";

}

Output would be "Good evening" in this situation

answered
User Hackose
by
8.3k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.