Examples: Variant data type

' Explicitly declare a Variant variable.
Dim someV As Variant
' Use the Variant variable to hold a Currency value.
Dim price As Currency
price@ = 20.00
someV = price@
Print DataType(someV)   ' Prints 6 (Currency)
' Use the Variant variable to hold an object reference.
Class Product
   Sub Sell(toCustomer)
      ' ...
   End Sub
End Class
Dim knife As New Product
Set someV = knife
Call someV.Sell("Joe Smith")   ' Calls Product method
' Use the Variant variable to hold an array.
Dim salesArray()
ReDim salesArray(3)
salesArray(1) = 200
salesArray(2) = 350
salesArray(3) = 10
someV = salesArray
Print someV(1)       ' Prints 200
' Use the Variant variable to hold a list.
Dim customerList List
customerList("one") = "Butcher"
customerList("two") = "Baker"
someV = customerList
Print someV("one")   ' Prints Butcher