0
只是需要一點點拋光工作輸出..安排在不同的行
command = ""
names = []
while command != "exit"
puts 'please enter names seperated by a space: '
command = gets.chomp!
if command == "quit"
names.sort! do|a,b| a.upcase <=> b.upcase end # use {...} for do\end, in a single entry rather then multiple
names.each_with_index do |name, index|
if index % 2 == 0
puts "#{name}", "\n"
else
puts "#{name.reverse}", "\n"
end
end
else
names << command
end
end
所以這是什麼編程'的作用是顯示一個數字,其中由用戶輸入的名字。我無法做到的是在對方下面顯示名字。例如。 搶 法案 露西 斬 ... 它然後向後顯示每秒名稱,在這樣的
搶
法案
露西
印章
顯示它們======
llib
pohc。
lolmy大腦煮熟有什麼建議?
感謝的人真正幫助 –