简单程序的Groovy错误;意外标记“;

简单程序的Groovy错误;意外标记“;,groovy,Groovy,有人能解释一下下面的错误吗?非常感谢:) 我的代码是: String str print “Please key in a word: “ str = System.console().readLine() println “The word was: “ + str print “Now please key in another: “ str = System.console().readLine() print = “And this one was: “ + str 似乎双引号是错误的

有人能解释一下下面的错误吗?非常感谢:)

我的代码是:

String str
print “Please key in a word: “
str = System.console().readLine()
println “The word was: “ + str
print “Now please key in another: “
str = System.console().readLine()
print = “And this one was: “ + str

似乎双引号是错误的,请尝试以下操作:

print "Please key in a word: "
用正确的引号替换程序中的所有引号。可能是你用错误的字体从文本中复制了代码

print "Please key in a word: "