Created
August 11, 2012 18:58
-
-
Save jumpingcloud/3326406 to your computer and use it in GitHub Desktop.
Naming variables with a variable.
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
class Rover | |
puts "It works" | |
end | |
class Nasa | |
@rover_id = 0 | |
def deploy_rovers | |
@rover_id += 1 | |
@rover#{@rover_id} = Rover.new | |
end | |
end | |
mission1 = Nasa.new | |
misson1.deploy_rovers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment