incendio Well-Known Member Licensed User Longtime User Apr 26, 2014 #1 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.
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 Apr 26, 2014 #2 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 Code: 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: Apr 26, 2014 Upvote 0
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 Code: 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
Edu Portu Member Licensed User Longtime User Jan 22, 2020 #3 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
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
Jorge M A Well-Known Member Licensed User Longtime User Jan 23, 2020 #4 Code: 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
Code: 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