movies = {
The Lion King: 4
}
when "display" || "3"
movies.each do |x,y| #here
puts "#{x}: #{y}"
end
这是否可以接受,或者这被认为是编程禁忌?特别是效率和与他人合作。这种做法是否很常见,因为它的要求是显而易见的,或者做得更好:
movies = {
The Lion King: 4
}
when "display" || "3"
movies.each do |title,rating| #here
puts "#{title}: #{rating}"
end