Created
April 21, 2010 09:12
-
-
Save alexrothenberg/373607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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