DIM call_params
AS sub_example_params
call_params.x = 10
call_params.y = 20
CALL example
(call_params
)
SUB example
(params
AS sub_example_params
) 'each param entry has whatever value was last written to it, hence not necessarily empty,
'to make it happen, you should ivalidate all params at the end of the sub to make them defaults
'for the next call
params.x = 5: params.y = 5
params.t = ""
'this would be the defaults for the next call unless they're changed before the next call
Backdraw, you need a lot of individual TYPEs for your individual SUBs/FUNCs...
There's a second problem with this approach: retained values not clearing between calls, or else values becoming altered (as per your example) after each call.
Honestly, I'd rather see something more like the following in my code:
SUB foo ( x, y, text$, passed)
IF passed = 0 THEN passed = 7 'all are valid without a limiter
IF passed AND 1 THEN 'x was passed
... stuff
END IF
IF passed AND 2 THEN 'y was passed
....
IF passed AND 4 THEN 'text$ was passed
...
END SUB
So now I can :
foo 12, 13, "Hello World", 0 'all params passed
foo 12, 0, "", 1 'only X passed
foo 0, 13, "", 2 'only Y passed
And so on...