Conditionals Practise

Hi, I’m posting my conditionals practice exercises for revision. I think number 3 is not working properly.

Ex 1
Ex 2
Ex 3
Ex 4

Thanks in advance.


Hi @Juan_Salerno!

I’ve tested all your code, and the first two work great - well done

For task 3, switch statements are a pain to write. In this case, we’d recommend the switch(true)pattern. Have a look at our answer, which also includes a link to an explanation:

The code in task 4 works, but I’d recommend putting the ternary operator line inside the if() {} part of the statement — it doesn’t make sense to be able to log in when the machine is off.

Apart from that, great work!