From: Matthew Feadler Date: 2005-12-23T07:46:25+09:00 Subject: Re: String > Integer Conversion Problem Matthew Feadler wrote: > Which is to say, it does everything I want it to. However, I wonder if > it can be optimized, condensed? > How 'bout corrected first? Guess my last post is a perfect argument in favor of my learning how to use test units. Corrected code be here: $usage = "Usage:" def print_usage(val) if val=="exit" print $usage exit else print $usage end end if ARGV!=[] and !(ARGV.length > 2) begin arg0, arg1 = ARGV.map{ |n| Integer(n) } if (arg0 < 0) or (!arg1.nil? and (arg1 < 0)) print_usage("exit") elsif !arg1.nil? and (arg0 > arg1) print_usage("exit") end rescue ArgumentError print_usage("exit") end else print_usage("exit") end -- Posted via http://www.ruby-forum.com/.