LJZN

每天更新Rails练习项目到Github~

» Home
» Category
» About Me
» Github

笨方法学Ruby第五天

26 Jun 2016 » LRTHW
name = 'Zed A. Shaw'
age = 35 # not a lie in 2009
height = 74 * 2.54# inches to centimeters
weight = 180 * 0.4535924 # lbs to kgs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'

puts "Let's talk about #{name}."
puts "He's #{height} centimeters tall."
puts "He's #{weight} kilograms heavy."
puts "Actually that's not to heavy."
puts "He's got #{eyes} eyes and #{hair} hair."
puts "His teeth are usually #{teeth} depending on the coffee."

# this line is tricky,try to get it exactly right
puts "If I add #{age}, #{height}, and #{weight} I get #{age + height + weight}."

Related Posts