Bound
Source: Positron8 Compiler User Manual, PDF page 300
Syntax
Variable = Bound (Variable)
Overview
The Bound function returns the size of a standard variable, in bytes - 1. If used with an array, it returns the amount of elements in the array - 1.
Example
' Create a loop for the amount of elements in an array
'
Device = 18F26K40
' Tell the compiler what device to compile for
Declare Xtal = 16
' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600 ' Choose the Baud rate for HRsoutLn
Dim WordArray[10] as Word
' Create an unsigned Word array variable
Dim bIndex as Byte
' Create a Byte variable
WordArray = 0, 100, 200, 300, 400, 500, 600, 700, 800, 900
For bIndex = 0 To Bound(WordArray)
HRsoutLn Dec bIndex, "=", Dec WordArray[Index]
Next
' Loop until all elements scanned