Plz help me

Pls Help me with this ruby:

print “How old are you cuz I need to know if you could watch naruto”
age = gets.chomp
if age > 13
puts " You definetly can"
elseif age < 13
puts “You Can’t”
else age = 13
puts"You are at the age of it"
I don’t get it

Can you provide more info? It’s difficult to help when we don’t know what you need assistance with.


Please also see how to format your post, [How to] Format code in posts as it will be easier for people to help.


I believe in Ruby gets.chomp returns a string, not an integer. You can’t compare integers and strings using > or <. In Ruby, there is no such thing as elseif. You have if, elsif, and else. Lastly, = is not a comparison operator in Ruby. There is == and ===. = is the assignment operator, which assigns the value on the right to the object on the left:

some_var = "nothing"
#some_var is now "nothing"
1 Like

What kind of info CUZ idk what info you are talking about

Thank You so much toastedpitabread!

1 Like

I would’ve needed information about what you’re confused about, but someone else figured it out.

I need help about why it doesn’t run when I use it in an if statement.

1 Like

It means the if statement conditions aren’t being met. You can test the conditions themselves by inspecting the objects of the condition.

1 Like

A post was split to a new topic: Keep getting an “execution expired” error