Page 1 of 1

TypeOf() with lists, arrays and maps

Posted: Wed Jun 22, 2022 4:08 pm
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.

Re: TypeOf() with lists, arrays and maps

Posted: Wed Jun 22, 2022 4:38 pm
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.

Re: TypeOf() with lists, arrays and maps

Posted: Wed Jun 22, 2022 4:53 pm
by Little John
infratec wrote:It can return #PB_List, if the field in a structure is a list.
I see. Thank you!