Conversation
dHelmgren
reviewed
Mar 8, 2019
| distance_from_sun = gets.chomp | ||
|
|
||
| puts "Planet Fun Fact:" | ||
| fun_fact = gets.chomp_to_i |
There was a problem hiding this comment.
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.
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.
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
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?