Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,7 @@
values = [1, 2, 3]
new_values = values.map do |number|
number * 2
end
puts new_values #=> [2, 4, 6]

View file

@ -0,0 +1,12 @@
values = [1, 2, 3]
def double(number)
number * 2
end
# the `->double(Int32)` syntax creates a proc from a function/method. argument types must be specified.
# the `&proc` syntax passes a proc as a block.
# combining the two passes a function/method as a block
new_values = values.map &->double(Int32)
puts new_values #=> [2, 4, 6]