Comparison of string with 0 failed


#1

Exercise 4: Elsif

Message: Comparison of string with 0 failed

print "Please enter an integer greater or less than 0"
number = gets.chomp

if number%2 == 0 && number > 0
    puts "even positive"
elsif number%2 == 0 && number < 0
    puts "even negative"
elsif number%2 != 0 && number > 0
    puts "odd positive"
else
    puts "odd negative"
end

#2

@equin_addict,
Reading the article
http://stackoverflow.com/questions/23193813/how-does-gets-and-gets-chomp-in-ruby-work
you will understand
that your number variable will be a string Value.....

You will have to convert the string to an integer
http://stackoverflow.com/questions/24980295/strictly-convert-string-to-integer-or-nil