The student is having his equations not equal the correction outcomes. I think his equations are not correct but I can’t figure out how to fix them. Any feedback would be helpful.
The way that @yanet.cabrera fixed this problem is that they simply defined what the maximum height is, what I mean by this is by the screenshot down below.
As you can see it’s just a number
It is not clearly defined what variable should do that task.
The way that they fixed this (as if you did not know already) is that they simply added the variable to the left of the variable to define it.
Basically define it.
I could be wrong about this as I’m not good in app lab, but this problem has occurred to me before in game lab.
Hope this has helped!
Yes, I didn’t have time to add the explanation yesterday so I figured I’d send the code and that it would help. Thanks for adding some clarity as to WHY the fix is what it is.
When using relational operators(< > <= >= == !=) you must put what values you are comparing on left and right of the operator. For example: 3 > 5 will check if 3 is greater than 5. There is what you are comparing on the left and what you are comparing it to on the right and in the middle the operator which says how you are comparing those two things. It would not make sense to write just > 5 the computer will not know what you are trying to see is bigger than 5.
In a compound boolean(combining relational and logical operators) the above is still true. The problem comes with how we speak sometimes we say “if height is bigger than or equal to 58 and less than 75” That implies we are still talking about height in the second “less than 75” part of the statement. The issue is that in programming the values you are comparing have to be explicitly written and will not be implied. So writing
height>=58 && <75 doesn’t make sense to the computer. It has to be fixed by instead writing
height>=58 && height <75
Also, on a different note anything not in quotations is assumed to be a variable unless its a keyword or a function name. So when writing
rollercoaster == twister that would also be incorrect because the computer will look for a variable named rollercoaster and a variable named twister and check if the values in those variables are the same. But twister isn’t a variable it’s meant to be a string in this case so it should go in “” so that we check if the value in the variable rollercoaster is equal to the string “twister”
rollercoaster == "twister"