Skip to content

Instantly share code, notes, and snippets.

@alexrothenberg
Created April 21, 2010 09:12
Show Gist options
  • Save alexrothenberg/373607 to your computer and use it in GitHub Desktop.
Save alexrothenberg/373607 to your computer and use it in GitHub Desktop.
# In DOS type
### cd \workshop
### mkdir ruby_exercises
### cd ruby_exercises
# Open the e editor
### e .
# Create a new file called symbol_exercise.rb
###################################################
### EXERCISE 1
puts "This is a symbol: #{:i_am_a_symbol}"
puts "This is a string: #{'i_am_a_string'}"
puts "This is inspecting a symbol: #{:i_am_a_symbol.inspect}"
###################################################
### EXERCISE 2
puts "Is a symbol the same as a string? #{:i_am_a_symbol == 'i_am_a_symbol'}"
puts "Is a symbol the same as another symbol? #{:i_am_a_symbol == :i_am_a_symbol}"
puts "Is a string the same as another string? #{'i_am_a_string' == 'i_am_a_string'}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment