Skip to content

Instantly share code, notes, and snippets.

@southpolesteve
Created December 13, 2012 05:23
Show Gist options
  • Save southpolesteve/4274240 to your computer and use it in GitHub Desktop.
Save southpolesteve/4274240 to your computer and use it in GitHub Desktop.

Strings in Ruby can be set with single or double quotes, but the behavior is slightly different. Double quotes allow for the ability to insert variables into a string. Check out the following example:

name = "Steve"
puts "My name is #{name}"
#=> My name is Steve
puts 'My name is #{name}'
#=> My name is #{name}

Double quotes also allow for some other things, but this is the major use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment