Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我执行
print("Enter your name: ") name=gets puts("\tHello, #{name}.")
,我得到:
Hello, Fohsap .
如何将句点 (.) 移到第一行?
gets将在返回的字符串中包含换行符。要删除它,您可以使用gets.chomp.
gets
gets.chomp