2013年2月20日

[转]ruby中gets 和 gets.chomp 区别

摘要: 其区别主要体现在输出时例如 : print"howoldareyou?" age=gets.chomp() print"howtallareyou?" height=gets.chomp() print"howmuchdoyouweight?" weight=gets puts"so,you're#{age}old,#{height}talland #{weight}heavy."#(这一整句都是在一行的) >rubytest.rb howoldareyou?11 howtallareyou?22 h 阅读全文

posted @ 2013-02-20 15:13 冰河程序猿 阅读(1865) 评论(0) 推荐(1) 编辑

导航