Page 1 of 1

QBasic function with optional arguments

Posted: Thu Dec 07, 2023 8:37 am
by skibidiQ
Is it possible to write a subroutine or a function with optional arguments?

for example:

Code: Select all

MyFunct (x AS INTEGER, [y AS INTEGER, Z AS INTEGER]) 
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:

Code: Select all

Myfunct 5
MyFunct 5,6,7
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:

Code: Select all

WINDOW (10,50)-(100,100) 
LINE (10,10)-(50,50
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?