ErosOlmi
18-05-2007, 07:46
We are working on adding the possibility to indicate default values for numeric parameters passed BYVAL in function calling.
To be more clear, it will be possible something like that:
uses "console"
'---Define a function with 2 mandatory BYVAL params having default values
' 3rd param is optional again with default value
' 4th param is again optional but no default value so its value in function will be 0 if not passed
function MyFunction(p1 as long = 100, p2 as long = 200, optional p3 as long = -1, p4 as quad)
console_writeline p1, p2, p3, p4
end function
console_writeline "--- many possible ways to call functions will be avaibale"
MyFunction(,)
MyFunction(,,)
MyFunction(,,2000)
MyFunction(,123,2000)
MyFunction(765,,2000)
MyFunction(765,,-150, 45)
console_waitkey
that will produce the following output:
--- many possible ways to call functions will be avaibale
100 200 -1 0
100 200 -1 0
100 200 2000 0
100 123 2000 0
765 200 2000 0
765 200 -150 45
We will start with numeric params but if all ok we will move to string params.
Stay tuned.
Eros
To be more clear, it will be possible something like that:
uses "console"
'---Define a function with 2 mandatory BYVAL params having default values
' 3rd param is optional again with default value
' 4th param is again optional but no default value so its value in function will be 0 if not passed
function MyFunction(p1 as long = 100, p2 as long = 200, optional p3 as long = -1, p4 as quad)
console_writeline p1, p2, p3, p4
end function
console_writeline "--- many possible ways to call functions will be avaibale"
MyFunction(,)
MyFunction(,,)
MyFunction(,,2000)
MyFunction(,123,2000)
MyFunction(765,,2000)
MyFunction(765,,-150, 45)
console_waitkey
that will produce the following output:
--- many possible ways to call functions will be avaibale
100 200 -1 0
100 200 -1 0
100 200 2000 0
100 123 2000 0
765 200 2000 0
765 200 -150 45
We will start with numeric params but if all ok we will move to string params.
Stay tuned.
Eros