gawk provides a single function that lets you distinguish
an array from a scalar variable. This is necessary for writing code
that traverses every element of a true multidimensional array
(see Arrays of Arrays).
Return a true value if x is an array. Otherwise return false.
isarray() is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is itself
an array or not. The second is inside the body of a user-defined function
(not discussed yet; see User-defined), to test if a parameter is an
array or not.
Note, however, that using
isarray() at the global level to test
variables makes no sense. Since you are the one writing the program, you
are supposed to know if your variables are arrays or not. And in fact,
due to the way
gawk works, if you pass the name of a variable
that has not been previously used to
will end up turning it into a scalar.