This code works fine :-
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
However this code give me the following error
syntax error, unexpected tIDENTIFIER, expecting kDO or ‘{‘ or ‘(‘
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
Can someone please explain why?
Thanks
It’s a parsing issue. Use parentheses to clarify: