Skip to content

Ports - Heather#15

Open
piffer59 wants to merge 1 commit into
Ada-C11:masterfrom
piffer59:master
Open

Ports - Heather#15
piffer59 wants to merge 1 commit into
Ada-C11:masterfrom
piffer59:master

Conversation

@piffer59

@piffer59 piffer59 commented Apr 9, 2019

Copy link
Copy Markdown

No description provided.

@pmanni02 pmanni02 left a comment

Copy link
Copy Markdown

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.

Comment thread lib/factorial.rb
raise NotImplementedError
total = number
if number == nil
raise ArgumentError, "number is nil"

Copy link
Copy Markdown

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