How is 6 <= 10?


#1

https://www.codecademy.com/courses/ruby-beginner-en-NFCZ7/3/2?curriculum_id=5059f8619189a5000201fbcb#

Please I don't understand how 6 is less or equals to 10 ?
I wrote this code :

in the console .. what I know that 6 is less than 10 it can't be equal.. what's wrong ?

a = 6
b = 10
if a <= b
    puts "a less or equals to b"
elsif a == b
  puts "a equals b"
else
    " a is not less or equals , also not equals if you see this line"
end

and I got: 
 a less or equals to b
nil


#2

Less than or equal to is an inequality expression that includes all integers less than 11. We are not saying the 6 is equal to 10, but less than 10.


#3

If the number is undetermined, <= or >= would suffice as we wouldn't know if it's less than or equal to. It works the same here except that the number is determined, so it would be less than. I works, like mtf said, for integers under 11.


#4

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