-
Notifications
You must be signed in to change notification settings - Fork 48
Sockets -Maria #33
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
base: master
Are you sure you want to change the base?
Sockets -Maria #33
Conversation
| distance_from_sun = gets.chomp | ||
|
|
||
| puts "Planet Fun Fact:" | ||
| fun_fact = gets.chomp_to_i |
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.
A couple of weird things are happening here. 1) You use gets.chomp_to_i on line 59 when you mean gets.chomp.to_i as you did on line 53. But, the fun fact isn't a number, it seems you mixed up line 56 and 59. More testing would have probably caught this.
| when "list planets" | ||
| puts solar_system.list_planets | ||
| when "get planet details" | ||
| puts solar_system.planet_details.summary |
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.
What if it doesn't find the planet? you should probably return planet.summary from planet_details instead.
| return planet | ||
| elsif planet.name != name.downcase | ||
| puts "no related data found, please enter a listed planet" | ||
| planet_details |
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.
This is a very dangerous way to call this method! Calling a method inside itself is called recursion, and if the method has a bug, there is no escape except to shut the program down.
Solar SystemWhat We're Looking For
|
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod run? What does it do?Hashinstead of an instance of a class?SolarSystemclass used aHashinstead of anArrayto store the list of planets?requirestatements? Which files neededrequires, and which did not? What is the pattern?