我正在做 Ruby the Hard Way (ex9) -> http://ruby.learncodethehardway.org/book/ex9.html
为什么找不到常量 PARAGRAPH?
错误=>:
$ ruby ex9.rb
ex9.rb:9: uninitialized constant PARAGRAPH (NameError)
代码(我的输入):
# Here's some new strange stuff, remember type it exactly.
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\n\Feb\nMar\nApr\nMay\nJun\nJul\nAug"
puts = "Here are the days: ", days
puts = "Here are the months: ", months
puts <<PARAGRAPH
Theres something going on here.
With the paragraph thing.
Well be able to type as much as we like.
Even four lines.
PARAGRAPH
注意:我修改了段落中的代码并删除了整数和可能的语句,例如“如果或”或“只是为了确保我没有做错其他事情。使用“正确”代码,我得到以下...
课程代码错误=>:
ex9.rb:12: syntax error, unexpected tIDENTIFIER, expecting $end
We'll be able to type as much as we like.
^
课程代码:(我的输入)
# Here's some new strange stuff, remember type it exactly.
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\n\Feb\nMar\nApr\nMay\nJun\nJul\nAug"
puts = "Here are the days: ", days
puts = "Here are the months: ", months
puts <<PARAGRAPH
There's something going on here.
With the PARAGRAPH thing
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
PARAGRAPH