[Gambas-user] How to test if result is an array

Benoît Minisini gambas at ...1...
Fri Mar 16 18:07:03 CET 2012


Le 16/03/2012 04:14, Randall Morgan a écrit :
> Hi,
>
> I am writing a small test suit and need to tell is the result I got back
> from a function is an array of some type.
> Does anyone have a solution for this?
>
> Thanks
>

You can do like that:

	Dim Result As Variant

	Result = TestFunction()
	If IsObject(Result) And If Result Is Array Then ...

Or that way:

	Dim Result As Variant
	Dim AnArray As Array

	Result = TestFunction()
	Try AnArray = Result
	If Not Error Then ...

Anyway, I compiled the last gb.gsl, and I got many very suspicious 
warnings. Did you aware of them? Or maybe you know what you are doing, 
but don't know how to write your code not to get these warnings?

-- 
Benoît Minisini




More information about the User mailing list