Double Versus Single Quotes In Ruby
Difference between
Published:
Last modified:
Strings in Ruby are specified with double quotes "a string"
or single quotes'another string'
.
The main difference is that double quotes allows:
- string interpolation:
name = 'John'
"Hello #{name}"
- escape sequence :
irb(main):> puts "a\nb" a b => nil irb(main):> puts 'a\nb' a\nb => nil
comments powered by Disqus
- Double Versus Single Quotes In Ruby
- Ruby Language OverviewAugust 9, 2016
- What Is The Difference Between Modules And Classes In RubyAugust 9, 2016
- Managing Ruby Gems Version For Each ProjectJune 10, 2016
Articles
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 . Terms and Policy.
Powered by SimpleIT Hugo Theme
·