UByte Statement

Declares variables of UByte type. (unsigned variable type, size: 2 bytes).

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

Parameters

varName
Specify the UByte 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 Optional.
(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
UByte is used to declare variables as UByte type. Variables of UByte type can contain values from 0 to 255. Local variables should be declared at the top of a function. Global and module variables must be declared outside functions.

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

UByte Statement Example
The following example shows a simple program that declares some variables as UByte type and assigns values to the variables.

The program monitors whether the top bit of “test_ok” is 1 or 0. The result will be displayed on the screen. (Since the value 15 is assigned to the variable, the bit with higher “test_ok” value is always set in this example.)

Function Test
    UByte A(10)         'Single dimension array of UByte type
    UByte B(10, 10)     'Two dimension array of UByte type
    UByte C(5, 5, 5)    'Three dimension array of UByte type
    UByte test_ok
    test_ok = 15
    Print "Initial Value of test_ok = ", test_ok
    test_ok = (test_ok And 8)
    If test_ok <> 8 Then
       Print "test_ok high bit is ON"
    Else
       Print "test_ok high bit is OFF"
    EndIf
Fend