When to use single vs. double quotes in a Rails app [duplicate]
Possible Duplicate:
Which style of Ruby string quoting do you favour?
Is there a good rule of thumb about when to use single or double quotes in ruby, and especially rails apps?
Doesn't one use more memory than the other? Is there any sort of convention the rails community has settled on?
The difference between using double quotes versus single quotes is that double quotes interpret escaped characters and single quotes preserve them.
Here is an example
puts "i \n love \n ruby"
#i
#love
#ruby
and
puts 'i \n love \n ruby'
#i \n love \n ruby
精彩评论