From: "Jan E." Date: 2012-04-11T13:22:45+09:00 Subject: Re: less absolutely horrible way to make sure array 1 only contains elements from array 2? Hi, I would simply check the choice *before* pushing it into @choices: #### UserError = Class.new StandardError @selections = [] begin invalid_choices = [] print "Make selections: " myselections = gets.chop.split " " myselections.each do |path| if choices.include? path # I don't see any problems with include? @selections.push path else invalid_choices.push path end end raise UserError if @selections.empty? rescue UserError puts 'No valid selections.' retry else unless invalid_choices.empty? puts "The following selections were invalid: #{invalid_choices.join ', '}" end end #### -- Posted via http://www.ruby-forum.com/.