Skip to content

Instantly share code, notes, and snippets.

View sayradley's full-sized avatar
🐎
Hard work

Marcin Radlak sayradley

🐎
Hard work
View GitHub Profile
@sayradley
sayradley / flatten.rb
Created December 3, 2018 07:45
flatten array
def flatten(array, flatten_array = [])
array.each do |element|
if element.instance_of?(Array)
flatten(element, flatten_array)
else
flatten_array << element
end
end
flatten_array
end