11. Generalizations

I don’t know how to use a Boolean expression that will print out the code in the else block of the if/else statement.

The expression that we are concerned about there is this one:

if(2015 < 2016)

If that is true then the commands in the first { } block run.

If that expression is false then the commands in the else { } block run.

Your task is to get the else { } block to run, in other words, make that expression into something false.

1 Like

ok first of all put back the comment // on your equation on top.

Now since the boolean “tricky” is equal to “False” and the if is (2015 < 2016) “true” it will print out the first quote “Stuck in the past…”)

so all you have to do is make the (2015 < 2016) be false for it to run the next quote “Upgraded to the future!”)

in other word something like this ( 2015 > 2016)

only use the example “Boolean expression” in the line 4

Solo usa cualquiera de los ejemplos de las “Expresiones Boleeanas” de la linea 4

Run your code without removing the comment line, so keep is like this: //(5 >= 3 && !(true || true) ).
so it looks grey you dont need the text beqause its not a statement.

you make the if statement false by changing the the date 2015 < 2016, or de Boolean expression.( >, ==, >=, <, <=).

Hope this wil help everyone

Yes it helped! I don’t know why, but when I wrote comment line again, it worked…

what’s the solution for this problem ??!