I know it is possible to pass a LIST as parameter to a procedure.
But it is possible for a procedure to return a LIST?
How?
Possible for Procedure to return LIST?
Re: Possible for Procedure to return LIST?
if you pass a List to the procedure through a parameter, you don't need to return it.
If you create a list inside a procedure, the only way is via memory.
If you create a list inside a procedure, the only way is via memory.
Code: Select all
Structure s_mylist
List MyList.s()
EndStructure
Procedure.i CreateList()
Protected *p.s_myList = AllocateStructure(s_mylist)
If Not *p : ProcedureReturn #Null : EndIf
AddElement(*p\MyList())
*p\MyList() = "Hello"
AddElement(*p\MyList())
*p\MyList() = "World"
ProcedureReturn *p
EndProcedure
Define *p.s_mylist
*p = CreateList()
If *p
ForEach *p\MyList()
Debug *p\MyList()
Next
EndIf
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Possible for Procedure to return LIST?
Cool thanks BISONTE
The happiness is a road...
Not a destination
Not a destination