On Dec 21, 2005, at 6:13 PM, Jacob Fugal wrote: > On 12/21/05, Timothy Hunter <cyclists / nc.rr.com> wrote: >> The Integer() method raises ArgumentError if given an empty, >> non-numeric, or otherwise non-well-formed string. > > On 12/21/05, James Edward Gray II <james / grayproductions.net> wrote: >> if ARGV.all? { |n| n =~ /\A\d+\Z/ } >> puts "Usage..." >> exit >> else >> one, two = ARGV.map { |n| Integer(n) } >> end > > So could we rewrite this as: > > begin > one, two = ARGV.map{ |n| Integer(n) } > rescue ArgumentError > puts Usage > exit > end Yeah, that's better. Neither of our versions checks the number of arguments though and we probably should... James Edward Gray II