map

写像。地図。

map

array=[1, 3, 7, 11, 17]
 array2=array.map{|n|n*3}
 puts array2
moomin:ProgrammingRuby tomomi$ ruby re.rb
3
9
21
33
51