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

Add an if-return Guard Syntax #7105

Open
Tracked by #7106
smores56 opened this issue Sep 19, 2024 · 0 comments
Open
Tracked by #7106

Add an if-return Guard Syntax #7105

smores56 opened this issue Sep 19, 2024 · 0 comments

Comments

@smores56
Copy link
Collaborator

smores56 commented Sep 19, 2024

We implemented a convenient reformatting of if-else statements to act as "early returns" at the start of functions in #7039.

Because of the planned introduction of a return keyword that actually performs early returns, we want to add a syntax for if-return guard statements like the following:

processData = \data ->
    if dataIsInvalid data then
        return Err InvalidData

    useData data

Once that is done, we should remove the if-else "early return" from #7039 and go back to the old formatting style for if-else.

@smores56 smores56 mentioned this issue Sep 19, 2024
4 tasks
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

No branches or pull requests

1 participant