What does the * (star) mean in Ruby? [duplicate]
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: What is the * operator doing to this string in Ruby Probably there is answer for that elsewhere, but I just don't know how to find it... If I am right, the * means multiple parameters if used in function definition: def hero(name, *super_powers) But what does * do in the code like this: Hash[*[[:first_name, 'Shane'], [:last_name, 'Harvie']].flatten] # => {:first_name=>"Shane", :last_name=>"Harvie"} 回答1: Variable