此代码工作正常: -
def rps_tournament_winner(tournament)
if tournament[0][0].kind_of?(String)
puts game_winner tournament
else
for i in 0..tournament.length-1
rps_tournament_winner tournament[i]
end
end
end
但是这段代码给了我以下错误语法错误,意外的 tIDENTIFIER,期望 kDO 或 '{' 或 '('
def rps_tournament_winner(tournament)
array = []
if tournament[0][0].kind_of?(String)
array << game_winner tournament
else
for i in 0..tournament.length-1
rps_tournament_winner tournament[i]
end
end
end
有人可以解释为什么吗?
谢谢