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

WTF, VB6? - Part 6

This is the sixth post in the WTF, VB6? series.
Previous posts:
Part 5
Part 4
Part 3
Part 2
Part 1

I have re-discovered this one just recently.
What do you think would be the outcome of the code below? True or False? Is it even a legal VB6's expression?

Debug.Print [5 ^ 4 * 3 + 2 - 1] = [1024 / 7 Mod 5]

The answer is: Yes, it is a legal expression, and the result can be either True or False. It depends on what you set it to be.
WTF, VB6?!?

See, VB6 allows one to name an Enum's member whatever one wants, even things that normally would not be legal identifiers, as long as one wraps them with square brackets.
This is a perfectly valid Enum as much as VB6 is concerned:

Enum LetsWreakHavoc
[]
[5 ^ 4 * 3 + 2 -1]
[1024 / 7 Mod 5] = 1 'Now, this one is equals to the one above
["This is not a string"]
[.]
End Enum

I suppose that's because when compiling it, VB6 replaces each enum member by its value, so it does not need to carry such weird identifiers along.

Andrej Biasic
2020-06-17