QBasic function with optional arguments
Posted: Thu Dec 07, 2023 8:37 am
Is it possible to write a subroutine or a function with optional arguments?
for example:
so that I can use the function with only the first argument and sometimes with all arguments, in the same program, like the following for example:
Also, is it possible to write a sub or a function that takes arguments in format that is used with some of the graphics commands in QuickBasic, like the WINDOW and LINE.. For example:
I tried using square brackets, [], because the manual said those represent the optional arguments, but I guess it is only for reading the syntax conventions. Is there any way to have optional arguments?
for example:
Code: Select all
MyFunct (x AS INTEGER, [y AS INTEGER, Z AS INTEGER])
Code: Select all
Myfunct 5
MyFunct 5,6,7
Code: Select all
WINDOW (10,50)-(100,100)
LINE (10,10)-(50,50