Files
ruby-examples-1/level5/41.rb
2026-01-15 14:01:21 +09:00

10 lines
165 B
Ruby
Executable File

#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
map을 사용해 배열의 제곱값 배열 생성
=end
array = [2, 3, 5, 7, 9]
puts array.map { |item| item ** 2 }