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

Fix plus operation type check in fibonacci function #39

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

fdounis
Copy link

@fdounis fdounis commented Sep 1, 2024

No description provided.

@fdounis
Copy link
Author

fdounis commented Sep 1, 2024

This pull request addresses an issue with the fibonacci function where the operands of the + operation could potentially be of invalid types. The original function did not ensure that the input was a valid number, which could lead to runtime errors when the function was called with non-numeric values.

Changes Made:
Added a type check at the beginning of the fibonacci function to ensure the input n is a valid number.
If n is not a number or is NaN, a TypeError is thrown with a clear message.

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.

1 participant