pocketlang
pocketlang copied to clipboard
Can parameter be declared with a default value ?
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.
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
I create a pull request for this isssue. https://github.com/ThakeeNathees/pocketlang/pull/278