Help with beginner code

Hello everyone. I’m trying to learn to program, and after some
searching I’ve decided to learn while using Ruby. I’m using the Chris
Pine guide for now, but I’ve gotten stuck on a simple program I’m
messing with. Here is what I have:

daysinyear = 365
hoursinyear = 8760
minutesinday = 60 * 24
secondsinday = minutesinday * 60
secondsinyear = secondsinday * 365

puts ‘How old are you?’
myage = gets.chomp

daysalive = myage * daysinyear

puts ‘You have been alive ’ + daysalive + ’ days.’

I just would like the program to multiply the age I enter in by 365 to
give me how many days that person has been alive.

Now I’m guessing that myage is a string, so I thought I’d have to turn
it into an integer for this to work. So I tried myage.to_i but I’ve
still had no luck. Any tips on how to make this work?

Mark

[email protected] wrote:

secondsinday = minutesinday * 60

I just would like the program to multiply the age I enter in by 365 to
give me how many days that person has been alive.

Now I’m guessing that myage is a string, so I thought I’d have to turn
it into an integer for this to work. So I tried myage.to_i but I’ve
still had no luck. Any tips on how to make this work?