Skip to content

Instantly share code, notes, and snippets.

View Haumer's full-sized avatar
🎯
Focusing

Alex Haumer Haumer

🎯
Focusing
  • London
View GitHub Profile
console.log("hello world")
def testing
end
body {
}
"hello here"
stuff
@Haumer
Haumer / B423_each_and_map.rb
Last active July 9, 2020 23:15
Short showcase of .each, .map and .map! and what they return
# .EACH, .MAP and .MAP!
numbers = [1, 2, 3, 4, 5] # this is our starting/original array
# EACH
numbers.each do |number|
number * 2 # simply multiplying each value by 2
end
#=> [1, 2, 3, 4, 5]
p numbers
# string
"Hello world"
# integer
423
# float
3.14
# array