下面是哈希:
hash = {
:home => {:team_name => "Brooklyn Nets", :colors => ['black','white'],
:players => {
{ player_name: "Alan Anderson",
number: '0',
shoe: '16',
points: 22,
rebounds: 12,
assists: 12 ,
steals:3 ,
blocks:1,
slam_dunks:1 }
}
},
:away => [:team_name, :colors, :players]
}
有谁可以告诉我为什么我一直收到这个错误?
syntax error, unexpected '\n', expecting =>
它说这发生在slam_dunks
行。
答案 0 :(得分:1)
hash = {
home => {:team_name => "Brooklyn Nets", :colors => ['black','white'],
:players => {
player_name: "Alan Anderson",
number: '0',
shoe: '16',
points: 22,
rebounds: 12,
assists: 12 ,
steals:3 ,
blocks:1,
slam_dunks:1
}
},
:away => [:team_name, :colors, :players]
}
删除播放器键内的额外括号,这导致错误。