我正在为一门课做“学习编程”的练习 5.6。我有以下内容:
puts 'What\'s your first name?'
first = gets.chomp
puts 'What\'s your middle name?'
middle = gets.chomp
puts 'What\'s your last name?'
last = gets.chomp
puts 'Hello, Nice to meet you first middle last'
我尝试了以下方法:
puts 'What is your first name?'
first = gets.chomp
puts 'What is your middle name?'
middle = gets.chomp
puts 'What is your last name?'
last = gets.chomp
puts 'Hello, Nice to meet you #{first} #{middle} #{last}'
当我得到最后一个“puts”时,它不会得到我写的名字,中间名和姓氏。它说,“你好,很高兴见到你第一个,中间,最后......而不是乔约翰史密斯例如,我做错了什么?
非常感谢你的帮助!对此,我真的非常感激!