BoundB Function

Purpose

bounds test

Syntax

byte = BoundB(n)

byte = BoundByte(n)

n: integer expression

Description

The BoundB(n) function tests if the parameter n fits in a Byte. This means that when n < 0 or n > 255 an error message is reported. Otherwise n is returned unchanged.

Example

Local a| = 5, b| = 45, c|

c| = BoundB(a| * b|) //  5 * 45 = 225 - No Error

c| = BoundB(c| * 2// 225 * 2 = 450 - Array Bounds Error

// or...

c| = BoundByte(c| * 2)

Remarks

The BoundB() function serves to find program errors by early discovery of any range violations. BoundByte is a synonym.

See Also

Bound(), BoundW(), BoundC()

{Created by Sjouke Hamstra; Last updated: 24/09/2014 by James Gaite}