#!/usr/bin/ruby # -*- coding: utf-8 -*- =begin reduce로 배열 합계 계산 =end array = [2, 3, 5, 7, 9] puts array.reduce { |sum,item| sum += item }