Byte Statement

Declares variables of type Byte. (2 byte whole number).

Syntax
Byte varName [(subscripts)] [, varName [(subscripts)]...]

Parameters

varName
Specify the Byte type and the name of the variable to be declared.
Maximum element number of the array variable
Optional. Dimensions of an array variable; up to 3 dimensions may be declared. The subscripts syntax is as follows
(ubound1, [ubound2], [ubound3])
ubound1, ubound2, ubound3 each specify the maximum upper bound for the associated dimension. The elements in each dimension of an array are numbered from 0 and the available number of array elements is the upper bound value + 1. When specifying the upper bound value, make sure the number of total elements is within the range shown below:

  • Local variable: 2,000
  • Global Preserve variable: 4,000
  • Global variable and module variable: 100,000

Description
Byte is used to declare variables as type Byte. Variables of type Byte can contain whole numbers ranging in value from -128 to +127. Local variables should be declared at the top of a function. Global and module variables must be declared outside functions.

See Also
Boolean, Double, Global, Int32, Int64, Integer, Long, Real, Short, String, UByte, UInt32, UInt64, UShort

Byte Statement Example
The following example shows a simple program that displays some values as Bit7e using Byte.

Function main
    Byte varByte
   
    varByte = 127
	Call BitCheckByte(varByte)

    varByte = -1
	Call BitCheckByte(varByte)
Fend

Function BitCheckByte(var As Byte)
    Print "Value:", var, " Bit7 =", BTst(var, 7)
Fend

[Output]

Value: 127 Bit7 = 0
Value: -1 Bit7 = 1