Created
June 10, 2016 13:04
-
-
Save alexgriff/4d0a65499944f9d6f37fccc37c2b5598 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
array = [[1],[2],[3]] | |
# 1 will it error? / name that error! | |
# 1a. | |
array.first + 1 | |
# 1b. | |
array.first.first + 2 | |
# 1c. | |
array.first.first.first + 3 | |
# 2 will it error? / name that error! | |
array.first.map do |element| | |
element * 4 | |
end | |
# 3 will it error? / name that error! | |
array.each do |element| | |
element.each do |sub_element| | |
puts sub_element.first | |
end | |
end | |
# 4 will it error? / name that error! | |
# 4a. | |
array.flatten.reverse.uniq.compact.reverse | |
# 4b. | |
array.flatten.uniq.compact.pop.reverse | |
# 5 will it error? / name that error! | |
array.each do |element| | |
element + [element] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment