Tony_G.
August 5th, 2006, 11:15 PM
Hello :D I'm very new to coding and I'm having a little problem.
I'm trying to just create a very simple program that subtracts two variables. I can't get it to work, though. I've tried a zillion different things, but this was my last attempt:
puts 'Please enter the year of your birth:'
ydob = gets.chomp
puts 'Please enter the current year:'
currentyear = gets.chomp
puts 'It has been ' currentyear-ydob ' years since your birth.'
How, how, how, HOW do I get the variables to subtract? I've tried everything I could think of.
I'm trying to just create a very simple program that subtracts two variables. I can't get it to work, though. I've tried a zillion different things, but this was my last attempt:
puts 'Please enter the year of your birth:'
ydob = gets.chomp
puts 'Please enter the current year:'
currentyear = gets.chomp
puts 'It has been ' currentyear-ydob ' years since your birth.'
How, how, how, HOW do I get the variables to subtract? I've tried everything I could think of.