Control flow in ruby


#1

in exercise 7 in control flow, this is my code
test_1 = 17 > 16

test_2 = 21 < 30

test_3 = 9 <= 9

test_4 = -11 > 4

ok so, test 1 iv put that 17 is greater than 16, test 2 iv put 21 is less than 30, test 3 iv put 9 is less than or equal to 9 (because this exercise seems to not want the double ==, no idea why not)
but test 4 iv put 11 is greater than 4, but apparently thats not correct??? has anyone else ran into this problem? is this actually incorrect or is this a bug i feel the explanation so far has been fine up until this exercise which really has no explanation as to why its incorrect? help please?


#2

-11 is not greater than 4

test_4 = -11<4


#3

11 is less than 4? how silly of me


#4

The “-” in “-11” means that it’s 11 less than 0.

To clarify, the exercise isn’t asking about magnitudes of the value, but the integer itself: a negative integer regardless of magnitude is less than a positive integer.


#5

oh my god i missed the - haha what a noob, thanks dude


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.