-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaves - Dominique #39
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
|
require_relative "planet" | ||
require_relative "solar_system" | ||
|
||
def main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting you to overwrite this file with Wave 3. It did me a scare when there was no loop! Remember, git will track changes, so as long as you commit, nothing is truly lost!
solar_system.add_planet(neptune) | ||
|
||
def planet_details(solar_system) | ||
puts "Which planet would you like to learn about?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't define methods inside other methods unless you are doing something very fancy! This can cause weird problems, and can make debugging a nightmare!
planet_details
and add_planet
are both defined inside of main
!
@planets.each_with_index do |planet, index| | ||
planet_array.push("#{index + 1}. #{planet.name}") | ||
end | ||
return "#{star_name} \n#{planet_array.join("\n")}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method run? What does it do?Hash
instead of an instance of a class?SolarSystem
class used aHash
instead of anArray
to store the list of planets?require
statements? Which files neededrequire
s, and which did not? What is the pattern?