How to use “gets” and “gets.chomp” in Ruby

前端 未结 6 1120
一整个雨季
一整个雨季 2020-12-01 06:29

I learned that gets creates a new line and asks the user to input something, and gets.chomp does the same thing except that it does not create a ne

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 06:40

    chomp returns a new String with the given record separator removed from the end of str (if present).

    See the Ruby String API for more information.

提交回复
热议问题