Returning Array from Method

Hello

I wanted to create a method returning an Array. That doesn’t seem to work. The returning parameter can only be a “ArrayInfo”. I’m aware of this thread: methods that return an array but it’s 6 years old, so I thought something might have changed in between.

So it’s still not possible to return an Array by a method?

Just define the return type as an array.

-Karen

Thank you, I tried but that ends up in an error on running it:

WinSDCard.GetActiveList Declaration
Syntax error Shared Function GetActiveList() As Array

Function GetActiveList As Array()

Thanks but I don’t know if I get you right:

  1. I don’t want to send an array to a method, I want to return an Array from that method
  2. I use the Inspector of the method to define the Return Type to “Array” (setting it to “Array()” also gives me an error)

Shared Function GetActiveList() As Double()

If you want a double array

Now I made it with your sample, thank you! In case others may run into the same issue:
Head to Inspector of the new method:
Method name: <method_name> (f.e. myMethod)
Return Type: () (f.e. String() )

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.