TypeOf() with lists, arrays and maps

Just starting out? Need help? Post your questions and find answers here.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

TypeOf() with lists, arrays and maps

Post by Little John »

According to the documentation of TypeOf(), its return value can be #PB_List, among others.
However, the last line of the following code raises a syntax error (tested with PB 6.00 beta 9 (x64) on Windows):

Code: Select all

NewList a.i()
AddElement(a()) : a() = 3
Debug a()
Debug TypeOf(a())
How can the return value of TypeOf() ever be #PB_List, if it is not possible to pass a list as parameter to TypeOf()?
The same problem exists with arrays and maps.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: TypeOf() with lists, arrays and maps

Post by infratec »

In your link:
TypeOf can be used to find out the type of a variable, or a structure field.
There is nothing written about lists.

It can return #PB_List, if the field in a structure is a list.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: TypeOf() with lists, arrays and maps

Post by Little John »

infratec wrote:It can return #PB_List, if the field in a structure is a list.
I see. Thank you!
Post Reply