x = [ 3 , 4 , 9 , 6 , 2 ] min = 99999 x.length.times { |i| if min > x[ i ] then min = x[ i ] end } printf( "配列xの中で最小値は%dです\n" , min )