buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.23k stars 35 forks source link

Default function arguments values #36

Closed giann closed 2 years ago

giann commented 2 years ago
| optional default value is always null
fun myFunction(str name = "Joe", num? age) > str {
    if (age != null) {
        return "{name} is {age}";
    }

    return "{name} is ageless";
}

| valid calls
myFunction();
myFunction("John");
myFunction(age: 12);