Jacob Fugal wrote: > def read_arguments > arg0, arg1 = ARGV.map{ |n| Integer(n) } > raise ArgumentError if arg0.nil? or arg0 < 0 > raise ArgumentError if arg1.nil? or arg1 < 0 > raise ArgumentError if arg0 > arg1 > return arg0, arg1 > rescue ArgumentError > print <<-USAGE > Usage > USAGE > exit > end > > a, b = read_arguments Very nice. I like this construction. However, I believe the above will throw the exception when I have only one valid arg, which is not what I want (1 or 2 args is correct; no more, no less). So, it should look like this, yes? def read_arguments arg0, arg1 = ARGV.map{ |n| Integer(n) } raise ArgumentError if (ARGV.length == 0) or (ARGV.length > 2) raise ArgumentError if (arg0 < 0) or (!arg1.nil? and (arg1 < 0)) raise ArgumentError if !arg1.nil? and (arg0 > arg1) return arg0, arg1 rescue ArgumentError print <<-USAGE Usage USAGE exit end a, b = read_arguments -- Posted via http://www.ruby-forum.com/.