Just a newbie


#1



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


Hello all. Sorry for bothering you. I am trying to learn Ruby. i just wrote these codes and i am pretty sure i did all right but i still got this error. I just want to know what is my mistake.

( I passed lesson someway prob logic is ok )

How old are you?undefined local variable or method `get' for # < Context:0xf219e4>


print "How old are you?"
user_num = Integer(get.chomp)

if  user_num < 15
    puts "You are still a child"
else user_num > 15 
    puts "You are a man!"
end


#2

It should be get string as in, gets.chomp.


#3

Before this lesson editor gave an example. it was like

print "Integer:"
user_num = Integer(get.chomp)

if user_num < 0
puts" It is negative" something like this i just copied that lines
(couldnt access that lesson that's why cant copy paste)

but even if change chomp to string still giving error.


#4

user_num = Integer(get.chomp)
undefined local variable or method `get' for #<Context:0x52c9c0>

user_num = Integer(gets.chomp)

#5

Thank you and really sorry for bothering you (so simple mistake)


#6

You're welcome. No need to apologize. We all make mistakes, and many of them are face-palmers. It's only human.


#7

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