我的琴弦有什么问题?

Nin*_*a2k -1 ruby string-literals

以下代码生成错误,我看不到问题.有人可以帮忙吗?

customer_array = [‘Ken’,’William’,’Catherine’,’Mark’,’Steve’,’Sam’]
customer_hash = {
‘Ken’ => ‘Fiction’,
‘William’ => ‘Mystery’,
‘Catherine’ => ‘Computer’,
‘Mark’ => ‘Fiction’,
‘Steve’ => ‘Sports’,
‘Sam’ => ‘Fiction’
}
# => customer_array.rb:6: syntax error, unexpected tSTRING_BEG , expecting '}'
# 'William' => 'Mystery'
#      ^
Run Code Online (Sandbox Code Playgroud)

bea*_*mit 6

问题似乎与那些奇怪的背引言有关.试试这个:

customer_array = ["Ken","William","Catherine","Mark","Steve","Sam"]
customer_hash = {
    "Ken" => "Fiction",
    "William" => "Mystery",
    "Catherine" => "Computer",
    "Mark" => "Fiction",
    "Steve" => "Sports",
    "Sam" => "Fiction"
}
Run Code Online (Sandbox Code Playgroud)