gets:获取键盘数据

p "enter the name"
name = gets.chomp
p "enter the age"
age = gets.chomp
p "#{name} is #{age}"

p和puts的区别

arr = ["one", "two", "three"]
p arr #["one", "two"],返回["one", "two"]
puts arr #one, two, 返回nil

results matching ""

    No results matching ""