Is it possible to have set up optional Function parameters?
I can't think of how this can be possible, but it would be convenient for me. Currently, calling a Function must have the exact correct number of parameters. Is there a way to set up so a Function can have optional parameters? I can only think of encasing all the parameters in a single array, therefore there is ONE parameter, and just varying what I include in the array.
Re: Is it possible to have set up optional Function parameters?
"renojim" wrote: I assume you really mean "optional", not just a parameter with a default value, although I can't really see the difference.
Right, it's "the same difference" . One can declare default values for some at the end of the list of arguments - and can check for default value as a flag if it was omitted. In other lagnguages (e.g. Lua) this is so idiomatic that does not have to spec it - if a function is called will less than the declared arguments, the rest are padded with `nil` (AKA null, invalid). This can be argued double-edged sword.
Coming from other scripting languages - like say Python - you would have heard the above approach as "default argument values". Another approach of Keyword Arguments can easily be simulated in BrS by passing a dictionary with key-value pairs.