Posts

Constant With Dot Operator (VBA)

Image
up vote 9 down vote favorite I want to have a catalog of constant materials so I can use code that looks like the following: Dim MyDensity, MySymbol MyDensity = ALUMINUM.Density MySymbol = ALUMINUM.Symbol Obviously the density and symbol for aluminum are not expected to change so I want these to be constants but I like the dot notation for simplicity. I see a few options but I don't like them. Make constants for every property of every material. That seems like too many constants since I might have 20 materials each with 5 properties. Const ALUMINUM_DENSITY As Float = 169.34 Const ALUMINUM_SYMBOL As String = "AL" Define an enum with all the materials and make functions that return the properties. It's not as obvious that density is constant since its value is returned by a function. Public Enu...