Created
November 10, 2016 05:36
-
-
Save vl3/3ed54da36803f47b190f1082c384428d to your computer and use it in GitHub Desktop.
CitrusByte exercise
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
def flatten ary | |
flattenized_ary = [] | |
ary.each do |element| | |
if element.class == Array | |
flattenized_ary += flatten(element) | |
else | |
flattenized_ary << element | |
end | |
end | |
flattenized_ary | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment