Last active
September 15, 2018 14:54
-
-
Save telegraham/3f823b4b32ad0cc2a404ae08feff2b06 to your computer and use it in GitHub Desktop.
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
dogs = [ | |
{ | |
name: "fido", | |
age: 4, | |
likes: ["play fetch", "bark", "piddle"] | |
}, | |
{ | |
name: "spot", | |
age: 10, | |
likes: ["sleep"] | |
}, | |
{ | |
name: "rover", | |
age: 6, | |
likes: ["chasing own tail", "rolling in dead things"] | |
} | |
] | |
## .each | |
# Used for: | |
# Method returns: | |
# Block should return: | |
# sample usage | |
dogs.each do |dog| | |
# do something clever here | |
end | |
## .map | |
# Used for: | |
# Method returns: | |
# Block should return: | |
# sample usage | |
dogs.map do |dog| | |
# do something clever here | |
end | |
## .select | |
# Used for: | |
# Method returns: | |
# Block should return: | |
# sample usage | |
dogs.select do |dog| | |
# do something clever here | |
end | |
## .find | |
# Used for: | |
# Method returns: | |
# Block should return: | |
# sample usage | |
dogs.find do |dog| | |
# do something clever here | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment