Return array from procedure?

Just starting out? Need help? Post your questions and find answers here.
Smetad_Anarkist
New User
New User
Posts: 8
Joined: Wed Jul 19, 2017 5:50 am

Return array from procedure?

Post by Smetad_Anarkist »

How can I get array-data back from a procedure? I've read somewhere that I should give it back through input/output arguments or something like that?

Would anybody like to share an example?
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Return array from procedure?

Post by skywalk »

http://www.purebasic.com/documentation/ ... dures.html

Code: Select all

;Example: Array as parameter
  Dim Table.Point(10, 15)
  Table(0,0)\x = 1
  Table(1,0)\x = 2
  Procedure TestIt(c.l, Array ParameterTable.Point(2))  ; The table support 2 dimensions
    ParameterTable(1, 2)\x = 3
    ParameterTable(2, 2)\x = 4
   EndProcedure
  TestIt(10, Table())
  MessageRequester("Table", Str(Table(1, 2)\x))
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply