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

Implement optional args #31

Merged
merged 4 commits into from Dec 25, 2021
Merged

Implement optional args #31

merged 4 commits into from Dec 25, 2021

Conversation

cursorweb
Copy link
Member

Finally, the feature we all want!

use io.println;

fn add(a, b, print = false) {
  if print { println(a + b); }
  return a + b;
}

println(add(1, 2)); // 3
add(1, 2, print = true); // 3

bug: the example doesn't work
the problem was with return and that would make it exit early
so we had to make a 'finally' clause
@cursorweb cursorweb merged commit 56f059c into master Dec 25, 2021
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

1 participant