Is there a document that describes the default value assumed by an object, declared but never used yet?
For example if I run Dim Var1 as string, what value does that variable contain?
What if it's a boolean? And an Integer?
What's stopping you from trying this out yourself with Debug.Print?
"" (vbNullstring) and NULL would have to be specifically asked for, because otherwise you wouldn't see anything.
Absolutely there is coercion because of the presence of an "=" - a relational operator - in the expression. That operator coerces the item on the left to be compatible with the item on the right (since the items on the right are constants and CAN'T be coerced.) However, the last two items have no operator so there is nothing to be coerced (as the argument of a diadic operator) and the monadic arguments being passed do not involve coercion either.
An unassigned variant is EMPTY not null.
But if it is empty it is also 0, and ""
It is like Schrodinger's Cat
Depending on how it is used it EMPTY, "", 0
VBA Reference - Microsoft Office Add-ins and Consultancy. One website for all Microsoft Office Users and Developers.
bettersolutions.com
Test to confirm
Code:
Public Sub EmptyVariant()
Dim x As Variant
Debug.Print IsEmpty(x)
Debug.Print x = ""
Debug.Print x = 0
Debug.Print IsNull(x)
x = 7
x = Empty
Debug.Print x
End Sub