Skip to content

Instantly share code, notes, and snippets.

@jumpingcloud
Created August 11, 2012 18:58
Show Gist options
  • Save jumpingcloud/3326406 to your computer and use it in GitHub Desktop.
Save jumpingcloud/3326406 to your computer and use it in GitHub Desktop.
Naming variables with a variable.
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