Skip to content

Instantly share code, notes, and snippets.

View chalmagean's full-sized avatar
💭
Having fun learning new things every single day

Cezar Halmagean chalmagean

💭
Having fun learning new things every single day
View GitHub Profile
products = [
{ id: 1, name: "Foo" },
{ id: 2, name: "Bar" }
];
# display products
products.each_with_index { |prod, idx| puts "#{idx}. #{prod[:name]}" }
# user picked 1
cart << products[1][:id]