Yes it is possible but only in a limited way: only numeric parameters and only if passed BYVAL
http://www.thinbasic.com/public/prod...ameter_val.htm
the help-file does not tell me, but I want to know what happens with Optional arguments?
can I set some default value to missing optional arguments somehow?
Last edited by ReneMiner; 30-10-2012 at 00:54.
I think there are missing some Forum-sections as beta-testing and support
Yes it is possible but only in a limited way: only numeric parameters and only if passed BYVAL
http://www.thinbasic.com/public/prod...ameter_val.htm
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
In looking at the supplied example, I see that
MyFunction(,)
has two missing arguments, so it would be
MyFunction(p1,p2).
But the printed result shows
100 100 -1 0.
Since p1 = 100, and p2 = 200, I think the result should be
100 200 -1 0.
Where have I gone wrong?
Regards
Bob
Hi Bob,
right you are.
I will open an issiue in Support.
http://www.thinbasic.com/community/p...hp?issueid=366
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Fixed, will be present in next 1.9.x beta update
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Two things:
1. I'm not sure about and want to know:
is there a difference? Is B valid?Sub A(Optional X , Y) Sub B(Optional X, Optional Y)
2. By searching help for Optional I found in
Navigation: thinBasic language > Script structure >Functions/Subs
an example:
Function Factorial(InVal AsNumber) As Number Dim Count AsLong Dim RetVal AsLong RetVal = 1 For Count = 2 To InVal RetVal = RetVal * i Next Function = RetVal End Function
where does i in line 7 come from ?
Last edited by ReneMiner; 13-06-2013 at 11:39.
I think there are missing some Forum-sections as beta-testing and support
- both are valid, thinBasic has some ... flexibility
"Optional" is considered just a marker: from the first "optional" param, all subsequent parameters will be automatically "optional"
But remember: not defined variable types are interpreted as VARIANT type. If you debug this little example you will see it.
Uses "Console" Sub A(Optional X , Y) PrintL Function_Name, x, y End Sub Sub B(Optional X, Optional Y) PrintL Function_Name, x, y End Sub a(1,2) b(3,4) WaitKey- My error, fixed. Variable "I" is instead "Count"
Thanks
Eros
Last edited by ErosOlmi; 16-06-2013 at 11:29.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks