Going through this as well and just finished these conditionals. Looking at your code, looks like you’re confusing the nesting of the ‘if…else if…else’ statements. The way I thought about it is, “if the machine is active/on, then do all these things, checking the scores, etc. ELSE (meaning the machine is inactive/off), then do this thing).” I think if you break it up that way, it’ll help clear up where you need to make the changes.
Also for the scores, you need to check if the score is BETWEEN a range, so not just <= 19 but also >= 0. So your conditions should have two using a comparison operator.
I’m really amateur, but sharing how I thought about it and got it to work
Thanks Mark, I really apricate your help :). I wrote this out initially, then looked at some others but I didn’t quite understand why I couldn’t do it this way. Thank you for clarifying and helping me out.
Hi @BattleCat! Roughly speaking, the two are equivalent — you can consider the former to be a shorter version of the latter.
As I understand it, in the former case you are explicitly testing whether the value is true, which works for what we want.
In the latter case you are basically testing whether the variable’s value exists, i.e. is not undefined or null. Any variable that is set to a valid value will evaluate to true when tested (except for empty strings and 0), whereas null and undefined evaluate to false. So therefore this version works as well.