Metamorphing Machine I rather be this walking metamorphosis
than having that old formed opinion about everything!

WTF VB6! Part 10

I've just stumbled on this one. It is not bad, actually, it is so amazing that the WTF above means "Wait - That's Fantastic!"
Take a look at the image below:

Visual Studio IDE running code

Note that the lower bound to Months array is 1, while its upper bound is 12.
The Len function is used to get the size of an element from the array. As it is an array of Integers, it prints 2.
There's only one little, tiny, minuscule detail: We are supposedly accessing its zeroth element.
But our array does not start at zero! Even so, we don't get a "Subscript out of range" error!
I tested it, and you can use any number at all: -1, 1000, whatever. It Just Works ()!
It works even when the array is not initialized, as in Dim Months().

WTF, VB6!!!

Next week we'll see how to suffer prejudice in two easy steps.

Andrej Biasic
2021-10-06