Initial Values

You may optionally assign an initial value using = value:

    Dim Counter As Byte = 10
    Dim Temperature As Integer = -5
    Dim Flag As Bit = 1

This improves readability and reduces the need for separate initialisation code.

Initialisation is supported for:

  • Byte, Integer, Word, Long, Float
  • Bit variables
  • Aliased variables (if the alias target is valid)
  • Arrays (initial value applies to all elements if supported by the compiler)

Example:

    Dim Buffer(8) As Byte = 0