From: Nikolai Weibull Date: 2011-10-14T22:41:36+09:00 Subject: Re: What’s the best way of checking if an argument has been given or not? On Fri, Oct 14, 2011 at 15:29, Bartosz Dziewoński wrote: > You can use this syntax, too. "args" becomes an array of all arguments given. > >  def foo *args >    if args.length==0 >      puts 'no argument was given' >    else >      puts args[0] >    end >  end > > If you only allow one argument, you should do some checking whether > there are too many. Your suggestion is valid. though it seems I underspecified my question in yet another way. Until Ruby gets a rb_scan_args equivalent, I’d rather not complicate my argument processing unnecessarily by destructuring an argument array by hand.