Interger examples


#1

can somebody give an emaple in what to do here, please?
print "Integer please: "
user_num = Integer(gets.chomp)

if user_num < 0
puts "You picked a negative integer!"
elsif user_num > 0
puts "You picked a positive integer!"
else
puts "You picked zero!"
end


#2

I don't remember this exercise. What are the instructions?


#3

that's the instruction, sorry it took so long
Check out the code in the editor. There's some new syntax there, but we'll bet you can guess what it does. Click Save & Submit Code to see the program in action! (Go ahead and give Ruby an integer—that is, a positive or negative number with no decimal bit.)


#4

this is the right answer but I'm not sure what I'm missing

print "Integer please: "
usernum = Integer(gets.chomp)
if usernum < 0
puts "You picked a negative integer!"
elsif user_num > 0
puts "You picked a positive integer!"
else
puts "You picked zero!"
end`


#5

But, then it's not really an exercise, it's just a preview to show you what you'll be learning in this lesson.


#6

thank you for taking the time to look at it