Created
October 11, 2018 20:30
-
-
Save tyleramos/08c5c60302de640804c66086b7f5a58b to your computer and use it in GitHub Desktop.
Debugging BE (Ruby) - arrays
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
a = [2, 3, 4] | |
b = %w[Cats Frogs Dogs] | |
new_array = [] | |
a.each do |item| | |
new_item = b[item].downcase | |
item = b + item | |
new_array.push(itom) | |
end | |
# I want to see a new_array that looks like this: | |
# ['4 cats', '6 frogs', '8 dogs'] | |
# Why does the above code blow up, and what can we do to fix it? | |
# Can you write this in a better way? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment