Skip to content

Instantly share code, notes, and snippets.

@webdesserts
Created July 4, 2012 16:19
Show Gist options
  • Save webdesserts/3048122 to your computer and use it in GitHub Desktop.
Save webdesserts/3048122 to your computer and use it in GitHub Desktop.
How to tell your programmer to go grocery shopping
#The Ruby code your mom should have handed you:
# products = { milk => [], eggs => [] }
# cart = []
cart << products[:milk].pop
if !products[:eggs].empty?
6.times do
cart << products[:eggs].pop
end
end
# What she actually told you:
unless !products[:eggs].empty?
cart << products[:milk].pop
else
6.times do
cart << products[:milk].pop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment