# illustrates returning multiple values from a function def get_three_ints puts "Enter three numbers on three lines:" a = gets.to_i b = gets.to_i c = gets.to_i return [a, b, c] end def main x, y, z = get_three_ints ave = ((x + y + z) / 3.0).round(2) puts "The average, rounded to two decimals, is " + ave.to_s end # call main if running from the command prompt: if __FILE__ == $0 main end