A recent thread on the forums made it clear there is some lack of clarity about ByVal and ByRef
So here’s yet another attempt.
Value types are ones that the data assigned to them is stored right IN the memory location the compiler set aside for them.
A statement like
dim i as integer
reserves a spot in memory when you compile. When you later do
i = 100
the value 100 is put in the spot reserved
For a reference type, one that you create using the NEW keyword, what is reserved by the compiler is a spot to hold the “address” of whatever kind of object defined. A statement like
dim d as Date
sets aside a spot to hold the address of a Date. When you later do
d = new Date
what gets put in the spot that was reserved is not the data for a Date object but the “address” of that data – the reference to the data