Hi! I need help

Hi guys I am new in this app but it so fun and I love learn for here. But I have a cuestión if someone can xplein me more why the answer pls


Thank for help

Hey there!

The code has an if statement inside another if statement. The quiz is asking which values will make both if statements true.

The outer if statement checks if bananas is !== (not equal to) 'green'.

If this is true, then the inner if statement checks if numberOfBananas > 5.

If this is true, then the print() statement runs and 'Let's make banana bread' is printed to the console.

Let’s look at the quiz’s incorrect answers to see why they are wrong:

bananas = 'brown'
numberOfBananas = 3

If bananas is 'brown', then the outer if statement is true, because bananas is not 'green'.

However, if inner if statement is false, because numberOfBananas is not greater than 5.

Let’s look at the other wrong answer:

bananas = 'green'
numberOfBananas = 10

The outer if statement is false, because bananas is 'green'.

The code inside the if statement only runs if the test is true. Because the outer if statement is false, then the computer won’t even look at the inner if statement.

Does this clear things up? Let me know if you have any questions.
Ben

1 Like