Identify the Array and Hash of Customers
customer_array = ['A','B','C','D','E','F']
customer_hash = {
'A' => 'Fiction',
'B' => 'Mystery',
'C' => 'Computer',
'D' => 'Fiction',
'E' => 'Sports',
'F' => 'Fiction'
}
j=0
for i in 0...customer_array.length
if customer_hash[customer_array[i]]=='Fiction'
puts "#{customer_array[i]} has brought fiction books"
customer_array[j]=customer_array[i]
j=j+1
end
end
Related examples in the same category