-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Added Fibonacci in Nim #1670
Added Fibonacci in Nim #1670
Conversation
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.
Any chance you could pull the latest changes from master? I just setup Nim for testing in #1667.
archive/n/nim/fibonacci.nim
Outdated
# Fibonacci Sample Program in Nim | ||
import strutils | ||
|
||
echo "Input the number of iterations (n): " |
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.
For this program, I'd take a peek at the requirements: https://sample-programs.therenegadecoder.com/projects/fibonacci/
We typically don't prompt for input. Instead, we pull it directly off the command line. Does Nim support command line args?
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.
Yeah once I saw the build failed I started looking into that. There are a number of ways, just trying to figure out an os-agnostic method.
Just took a peek at your tests. Everything looks great! At this point, it's an output formatting issue. We print all terms in the sequence in order by index:
|
archive/n/nim/fibonacci.nim
Outdated
echo "Usage: please input the count of fibonacci numbers to output" | ||
quit(1) | ||
except ValueError: | ||
echo "invalid input: not a number" |
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.
We use the same string for both cases. Sorry if that was confusing in the table.
echo "invalid input: not a number" | |
echo "Usage: please input the count of fibonacci numbers to output" |
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.
Updated
Yes - this was the invalid file name that should have been tracked for
removal when it was renamed to hello_world.nim
…On Wed, Oct 16, 2019, 11:50 PM Jeremy Grifski ***@***.***> wrote:
Was hello-world.nim intentionally deleted? Looks like it's going to get
deleted when we merge this pull request.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1670?email_source=notifications&email_token=ABWFAEAJF2YDXIRLX2MUUA3QO7VI3A5CNFSM4JBS4G6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBOYNQY#issuecomment-543000259>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWFAEGTWBT2RMGH3WX2V4DQO7VI3ANCNFSM4JBS4G6A>
.
|
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.
Nice work!
Code Snippets
Added/Updated <Sample Program> in <Language>
format