Literally Ruby

I’ve long been a double-quote user and thought it odd that languages supported both that and a single-quote for string literals. Ruby though is a bit clever. A single-quote e.g. ‘literal text’ tells Ruby not to waste time looking inside the string. Double-quotes e.g. “Hello {#name}” tells Ruby that you want it to interpret the contents. In this case Ruby will replace #name with the variable’s value.

Viewing 2 Comments

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus