coffee = name: 'French', strength: 1 console.log coffee # Spaced-out writing coffee = name: 'French' strength: 1 console.log coffee coffee = name: 'French' strength: 1 brew: -> console.log "Brewing #{@name}" pour: (amount = 1) -> if amount is 1 "Poured a single cup" else "Poured #{amount} cups" coffee.brew() console.log coffee.pour() console.log coffee.pour(2) coffees = french: strength: 1 in_stock: 20 italian: strength: 2 in_stock: 12 decaf: strength: 0 in_stock: 0 console.log coffees # For key, value of object. Notice how the "for" applies to everything to its # left, including the console.log. console.log "#{coffee} has #{attrs.in_stock}" for coffee, attrs of coffees # It compiles exactly like this: for coffee, attrs of coffees console.log "#{coffee} has #{attrs.in_stock}" to_print = for coffee, attrs of coffees when attrs.in_stock > 0 "#{coffee} has #{attrs.in_stock}" console.log to_print.join(", ")