Differences Between Properties and Variables
A variable always corresponds directly to a location in memory. A local variable is defined inside a procedure and is available only within that procedure. A member variable is defined inside a module, Class, or Struct and is sometimes called a field.
A property is a data element defined on a Library module or Class.
- Variable: A single declaration statement.
- Property: Commonly a series of statements in a block of code.
- Variable: A single location in memory.
- Property: Executable code.
- Variable: Directly associated with its value.
- Property: By default, has internal storage not available outside of the property.
- Executable code
- Read and write access
- Variable: Read/write or (for a Const) read-only.
- Property: Read/write, read-only, or write-only.
- Custom actions in addition to getting and setting a value
- Variable: Not possible.
- Property: Can be performed in getter and setter procedures, respectively.