views:

116

answers:

3

Is there a difference? I am new to this.

+4  A: 

Jim Hoskins clears it up.

%Q is the equivalent to a double-quoted ruby string. #{expression} evaluation works just like in double-quoted strings, even if you use %Q{} as your delimiter!

You can also leave off the Q and it will have the same functionality. I recommend leaving the Q in to be more clear.

mcandre
It could be nice if you could post a summary or a quote from the article instead of just giving a link.
musicfreak
thanks for the link.. a little neat summary of things :)
Xinxua
Added in the quote that's directly relevant.
Garry Shutler
+1  A: 

There are in effect the same. Both follow double-quoted string semantics

ennuikiller
+3  A: 

No, there is no functional difference. Some might argue that %Q{} is a little clearer, but both are interpolated strings (just like using double quotes).

John Hyland