Page 1 of 1
Any way to make a LIST parameter optional?
Posted: Wed May 15, 2024 11:34 am
by jassing
something like:
Code: Select all
Procedure fish( List test()=NewList )
EndProcedure
fish(#Null)
Re: Any way to make a LIST parameter optional?
Posted: Wed May 15, 2024 12:56 pm
by AZJIO
?
Code: Select all
Procedure fish( List test() )
ClearList(test())
EndProcedure
Procedure fish()
Protected NewList test()
EndProcedure
Re: Any way to make a LIST parameter optional?
Posted: Wed May 15, 2024 1:50 pm
by STARGÅTE
Only if you use a helper structure:
Code: Select all
Structure MyList
List Test.i()
EndStructure
Procedure fish( *MyList.MyList = #Null )
If *MyList
ProcedureReturn ListSize(*MyList\Test())
Else
ProcedureReturn 0
EndIf
EndProcedure
Define MyList.MyList
AddElement(MyList\Test())
Debug fish(MyList)
Debug fish(#Null)
Re: Any way to make a LIST parameter optional?
Posted: Wed May 15, 2024 3:05 pm
by jassing
STARGÅTE wrote: Wed May 15, 2024 1:50 pm
Only if you use a helper structure:
that's how I currently do it; but it's, er, inelegant.
thanks.
-j