Skip to content
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

Ports - Heather #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Ports - Heather #15

wants to merge 1 commit into from

Conversation

piffer59
Copy link

@piffer59 piffer59 commented Apr 9, 2019

No description provided.

Copy link

@pmanni02 pmanni02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall 👍 If you wanted to refactor/DRY this up further think about ways you can capture the edge case of number ==0 without explicitly checking for it.

raise NotImplementedError
total = number
if number == nil
raise ArgumentError, "number is nil"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this works for this fn because factorial is a known concept in math, I would rethink the message. For example, number cannot be nil or input cannot be nil. These messages tell the user what the input is and why an error was thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants