With an empty array of numbers the result will be zero, for string the result is an empty string, even if the default value is changed.
For numbers it could result in a NaN, but what result we would expect from a empty array of strings? NI would create a "NaS" standing for "Not a String"? But what LabVIEW should do with all other kind of empty arrays?
Like Nan and Nas they should create some indication to show that its an empty array.
Now Empty array is meaningless, because it contains a value. They can maintain the data type, but the index value should give a feeling that , we are reading the index of an empty aray.
An empty array doesn't contain ANY element, there is no value to read. It is a foundational functionality of LV to return the default value of the datatype in such a situation.
As enum is an integer type, it will return '0'.
The behavior is both "works as expected" and "works as intended".
Norbert
EDIT: It sounds like you want to have Index Array to have an Error Out connector and it will create at least a warning if you index an invalid item.
Norbert ---------------------------------------------------------------------------------------------------- CEO: What exactly is stopping us from doing this? Expert: Geometry Marketing Manager: Just ignore it.
I really wouldn't like this. If you start adding "not a boolean", "not an enum", etc. to each data type, you will both have to define how each primtive function behaves when taking that value and you will have to account for it everywhere you use the data type (you can be almost certain that there are places in your code where your code will start a cascade reaction of failures if it somehow gets a NaN you didn't anticipate).
If it's really important not to accept empty arrays, then use the Empty Array? primitive and handle it. In many places, an empty array is actually a perfectly valid value and indexing an out of bounds value is also valid.
Anything that adds overhead to the array indexing process is bad news. You could always create your own wrapper to introduce error functionality if you want.
MKsarith there is no such thing as an empty enum type in LV. An enum wire may contain only the values defined in the enum. No more, no less. Ever. The default value of an enum is the zeroth value of the enum, and the Index Array prim returns the default value of the array's data type.
This is correct behavior, fully intended, and will not be changed.
Declined for reasons listed here: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Indexing-the-empty-array/idc-p/3202258#M32763