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

Can parameter be declared with a default value ? #254

Open
khchen opened this issue Jun 19, 2022 · 2 comments
Open

Can parameter be declared with a default value ? #254

khchen opened this issue Jun 19, 2022 · 2 comments
Labels
TODO It hasn't implemented yet.

Comments

@khchen
Copy link

khchen commented Jun 19, 2022

For example:

  def inc(v, n = 1)
    return v + n
  end

  v = 0
  print(inc(v))
  print(inc(v, 2))

--
I love this little script language very much, please keep going on.

@ThakeeNathees ThakeeNathees added the TODO It hasn't implemented yet. label Jun 21, 2022
@ThakeeNathees
Copy link
Owner

Hi, thanks for the suggestion, I've been busy lately and not been able to maintain this, anyways I'm adding this to the todo list. This is doable, even if the default value is an expression example:

def some_function(v = other_function())
end

@khchen
Copy link
Author

khchen commented Jul 22, 2022

I create a pull request for this isssue.
#278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO It hasn't implemented yet.
Projects
None yet
Development

No branches or pull requests

2 participants