Variables

A variable names an area of storage whose value can change during execution of an application.

You declare a variable to be of a particular type, which restricts the kind of value the variable can hold (except for variables of type Variant). You also determine the scope and lifetime of a variable -- when and how long the variable exists and in what parts of your application it is accessible. Typically, if you do not choose a type or scope for the variable, LotusScript® chooses by default.

A variable name can be any valid LotusScript® identifier. The name cannot be the same as the name of another variable, constant, or procedure in the same scope used in the same module.

A variable can be of any of the following data types or structures:

  • The scalar types that LotusScript® recognizes: Boolean, Byte, Integer, Long, Single, Double, Currency, or String
  • An array or a list
  • A Variant
  • A user-defined data type, that is, a type defined with a Type...End Type statement
  • A class defined with a Class...End Class statement, or a class defined by the IBM® software with which LotusScript® is running

The next two sections describe the two ways you can declare a scalar variable in LotusScript®: with an explicit statement or by implication. Subsequent sections describe how to declare arrays, lists, and variables of type Variant.