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

Rust port of 65 Nim #632

Merged
merged 3 commits into from
Mar 13, 2022
Merged

Rust port of 65 Nim #632

merged 3 commits into from
Mar 13, 2022

Conversation

DLotts
Copy link

@DLotts DLotts commented Mar 13, 2022

Nim in Rust. This was a real challenge because of all the goto's going out of loops down to code below. I used a ton of breaks and continues. I tried to figure out how I would have written these without them, but I'm not seeing it yet. I handled them like this:
let is_odd=false;
loop {
stuff;
if x%2!=0 { is_odd=true; break };
if done {break};
stuff;
}
if is_odd {
handle_odd();
}
regular_stuff();

The logic in this is a little tricky, especially with arrays being a little different. I think I got all the bugs, because it seems to win no matter what I do.

@coding-horror
Copy link
Owner

Excellent! I'll be sure to move your comments to the readme.md for future porters!

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.

None yet

2 participants