-
Notifications
You must be signed in to change notification settings - Fork 15
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
Early return could be doable with if-else? #8
Comments
Yes, its doable in simple situations like this, but there is problematic cases. For example consider this: if(x){
SomeAction();
} else {
return f;
}
return 0; This cannot be directly rewritten into F#, because To more complicate things, return can be in any combination of |
This is possible as I have done it in my own solution. Here are the tests that I have over my solution (to sovle you pain of writing C#), which I believe covers most cases.
NB: I believe the same approach can be done for |
Wanted to reply to last comment from @jindraivanek:
That should be converted to this:
@willsam100 does your converter cover this corner case? |
@willsam100 Oops, nevermind, I just read the code of your last comment :) |
|
If it is helpful, my implementation of this is open-sourced here: https://github.com/willsam100/FShaper |
Documentation says early returns are not supported.
What this means?
I think early return could be doable:
with:
The text was updated successfully, but these errors were encountered: