From: Alex Young Date: 2007-05-10T09:49:26+09:00 Subject: Re: Passing info to classes and methods rgossen wrote: > On May 9, 12:22 am, Greg wrote: >> On 2007-05-08 18:47:50 -0700, Rob Biedenharn said: >> >> >> >>> On May 8, 2007, at 9:10 PM, Greg wrote: >>>> def pick_an_orange numToPick >>>> puts 'Got to pick_an_orange, now trying to get it working. >>>> numToPick: #{numToPick}' # debugging >>> Did you mean to have puts "Got ... #{numToPick}" in "double-quotes" to >>> interpolate the #{numToPick}. In single quotes, you'll get literally: >>> Got to pick_an_orange, now trying to get it working. numToPick: # {numToPick} >>> Does that help you? >>> -Rob >> Thanks, I missed that I had single quotes. I think I'm learning that >> double quotes are safer. For some reason Pine uses single quotes. I >> mainly need to get used to reading Ruby so I can see errors. >> Practice... > > I'm a newb as well so take this for what it's worth. > > My understanding is that the Ruby interpreter handles single quotes > faster than double quotes, so you should use single quotes if doubles > aren't necessary. I don't know how appreciable the speed difference > is, or if that difference is worth potentially causing the kind of > problem that you encountered. Measure it (that's what the Benchmark library is for). You'll be surprised. To cut a long story short, the only difference between single- and double-quoted strings is in the parsing. In practice, you won't notice a difference. The most important practical use for single-quotes over double-quotes (at least in my book) is to signal to the developer whether there should be anything interesting inside the string, rather than any performance considerations. -- Alex