HPlogo System Debug Reference Manual > Chapter 10 System Debug Standard Functions

func bound

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Checks for an existing definition of an operand and returns its definition type.

Syntax



   bound (operand)

The BOUND function uses the name in operand to check for an existing definition for that name. The type of the definition is returned in a string. The following table lists all possible types:
NUMBER

A valid numeric expression (in current input base)

ENV

A predefined environment variable

VAR

A user defined variable

FUNC

A predefined function

MACRO

A user defined macro

PROCEDURE

A valid procedure name (in current mode)

ALIAS

An alias definition

COMMAND

A command name

WINDOW_COMMAND

A window command name

UNDEFINED

No definition is currently bound

The table is searched in order from top to bottom. The first type which matches is returned. Additional matches may be possible but are not tested.

Formal Declaration



   bound:str (operand:str)

Parameters


operand

A string expression naming the operand for which the definition type is returned.

Examples



   $nmdebug > if bound('list') <> 'VAR' then var list slowbuildlist('ALL')

BOUND is often used to determine if a particular variable has been defined. In this example, which might typically be found in a macro, BOUND is used to test for the prior definition of the variable named "list". If the variable has not yet been defined, then it is created and assigned the return value from the macro named slowbuildlist.

   $nmdebug > wl bound('123')
   NUMBER
   $nmdebug > wl bound('add')
   NUMBER

123 and ADD are both numbers (in the current input base).

   $nmdebug > wl bound('s')
   ENV

S is an environment variable (the CM S register). Note that S is also a command name (Single Step), but only the first match is returned.

   $nmdebug > wl bound('BOUND')
   FUNC

BOUND is a function (in fact, the one this page is describing).

   $nmdebug > wl bound('slowbuildlist')
   MACRO

SLOWBUILDLIST is a user defined macro.

   $nmdebug > wl bound('12w')
   UNDEFINED

12w is undefined. No existing definition for 12w could be located.

Limitations, Restrictions


none




func bool


func btow