Created
July 4, 2012 16:19
-
-
Save webdesserts/3048122 to your computer and use it in GitHub Desktop.
How to tell your programmer to go grocery shopping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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