Hello,
I hope this hasn't been asked before, it seems using the optional parameter won't work with Tailbite
(with Procedure MyProcedure(parameter=2) for instance.
I think in the past we used to have Procedure2 Procedure3 for this, but now it is native with Purebasic could it be too for Tailbite ?
cheers
optional parameter
Moderators: gnozal, ABBKlaus, lexvictory
Re: optional parameter
Sorry, but no. You have to stick with the old fashioned way.Polo wrote:Hello,
I hope this hasn't been asked before, it seems using the optional parameter won't work with Tailbite
(with Procedure MyProcedure(parameter=2) for instance.
I think in the past we used to have Procedure2 Procedure3 for this, but now it is native with Purebasic could it be too for Tailbite ?
cheers
But you could write a procedure with optional paramters and then write some ProcedureDLL/ProcedureDLL2/ProcedureDLL3 ... :
Code: Select all
Procedure MyOptionalParameterTest(A=1,B=2,C=3)
MessageRequester("MyOptionalParameterTest",Str(A)+Str(B)+Str(C))
EndProcedure
ProcedureDLL MyTest()
MyOptionalParameterTest()
EndProcedure
ProcedureDLL MyTest2(A)
MyOptionalParameterTest(A)
EndProcedure
ProcedureDLL MyTest3(A,B)
MyOptionalParameterTest(A,B)
EndProcedure
ProcedureDLL MyTest4(A,B,C)
MyOptionalParameterTest(A,B,C)
EndProcedure
Look @ this polo : http://www.purebasic.fr/french/viewtopi ... =optionnel
Code: Select all
Declare MyTest4(A,B,C)
ProcedureDLL MyTest()
ProcedureReturn MyTest4(1,2,3)
EndProcedure
ProcedureDLL MyTest2(A)
ProcedureReturn MyTest4(A,2,3)
EndProcedure
ProcedureDLL MyTest3(A,B)
ProcedureReturn MyTest4(A,B,3)
EndProcedure
ProcedureDLL MyTest4(A,B,C)
; MyTest(A=1, B=2, C=3) < ----
; your code
EndProcedure
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

only the syntax is difference, but the way and the result is the same 

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
