Android Question What is the syntax to return multiple values from sub/procedure?

Status
Not open for further replies.

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

Just a noob question, is it possible to return multiple values from a sub?
If so, how is the syntax?

Thanks in advance.
 

DonManfred

Expert
Licensed User
Longtime User
You just can have ONE returnvalue. BUT this returnvalue can be a list, map, object or even a single value (string, int, double)

you can use a Map for Example

B4X:
sub MySpecialSub() as map
  Dim resultmap As Map
  resultmap.Initialize
  resultmap.Put("Name", "ABC")
  resultmap.Put("Date", "July, 2014")
  resultmap.Put("Number", "123456")
  resultmap.Put("Reference", "71 cases")
  return resultmap
end sub
 
Last edited:
Upvote 0

Edu Portu

Member
Licensed User
Longtime User
is it possible to return multiple panels from a sub?

B4X:
sub Panelscreate() as ????
Dim panel1, panel2 as panel
panel1.initialize()
panel2.initialize()
....
return ????
end sub
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
B4X:
Sub PanelsCreate() As List
    Dim lstPanels As List
    lstPanels.Initialize
    
    Dim panel1, panel2 As Panel
    panel1.initialize("")
    panel2.initialize("")
    
    lstPanels.Add(panel1)
    lstPanels.Add(panel2)
    
    Return lstPanels
End Sub
 
Upvote 0
Status
Not open for further replies.
Top