Archive for the ‘Literal’ Category

Literally Ruby

Thursday, May 11th, 2006

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.