Created
November 5, 2008 18:39
-
-
Save jakedouglas/22395 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
irb(main):001:0> @foo = "abc" | |
=> "abc" | |
irb(main):002:0> @bar = "def" | |
=> "def" | |
irb(main):003:0> @baz = "ghi" | |
=> "ghi" | |
irb(main):004:0> ["foo", "bar", "baz"].each do |var| | |
irb(main):005:1* puts "Hi my name is " + var + " and my value is " + instance_variable_get("@#{var}") | |
irb(main):006:1> end | |
Hi my name is foo and my value is abc | |
Hi my name is bar and my value is def | |
Hi my name is baz and my value is ghi | |
=> ["foo", "bar", "baz"] | |
irb(main):007:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment