def f( x , a ) x[ 0 ].length.times { |i| if x[ 1 ][ i ] == a then return x[ 0 ][ i ] end } return nil end x = [ [ 'D' , 'A' , 'E' , 'C' , 'B' ] , [ 70 , 85 , 60 , 45 , 30 ] ] a = 60 if f( x , a ) != nil then printf( "点数が%d点なのは%sさんです\n" , a , f( x , a ) ) end