Sard Aukary wrote:
> Is there a way  to refer to the arguments passed to a function, so I can 
> avoid re-stating the argument inside it like the example below?
> 
> puts "this is a test"[4.."this is a test".length]

In your particular case, it can be restated as:

   puts "this is a test"[4..-1]

Where the -1 refers to the end of the string.

In general, if you have a long expression you wish to refer to twice, 
you can

(1) make a local variable:

   s = "this is a test"
   puts s[4..s.length]

or (2) make a method

   def s
     "this is a test"
   end
   # ...
   puts s[4..s.length]

I'm not sure how your example relates to function arguments ... but is 
this helpfull?

-- Jim Weirich

-- 
Posted via http://www.ruby-forum.com/.