repl.it
@christinaSmith/

Calculate_age_ruby

Ruby

No description

fork
loading
Files
  • main.rb
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
puts "What year were you born?"
year = gets.to_i

def calculate_age(year)
    age = 2018 - year
    return age
end

your_age = calculate_age(year)

puts "You are #{your_age}"
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
?