Notifications
Clear all

[Closed] function argument optimization

So say I have a function that looks like this:

fn myFunctionName varA varB varC varD varE = (varC)

Now I want to send a value to the functions third argument (varC), does the resulting call have to look like this?:

myFunctionName(“”)(“”)(“hello”)(“”)(“”)

Or is their a way to just send the third argument without all the empty brackets?

2 Replies

mxs function can take optional arguments. it looks as:

fn action arg1: arg2: arg3: = ()

you can specify any of them as:

action arg2:2

also you can specify default values for optional arguments:

fn action arg1:1 arg2:2 arg3:3 = ()

as well as use combination of positional and keyword arguments:

fn action arg1 arg2: arg3: = ()
action 1 arg2:2 arg3:3

That’s awesome, exactly what I wanted to know. Thanks!