|
5.1.13 defined
Syntax:
defined ( name )
Type:
int
Purpose:
returns a value <>0 (TRUE) if there is a user-defined object with this name,
and 0 (FALSE) otherwise.
A non-zero return value is the level where the object is defined (level
1 denotes the top level, level 2 the level of a first procedure, level 3
the level of a procedure called by a first procedure, etc.). For ring
variables, -1 is returned.
Note:
A local object m may be identified by if
(defined(m)==voice) .
Example:
ring r=(0,t),(x,y),dp;
matrix m[5][6]=x,y,1,2,0,x+y;
defined(mm);
→ 0
defined(r) and defined(m);
→ 1
defined(m)==voice; // m is defined in the current level
→ 1
defined(x);
→ -1
defined(z);
→ 0
defined(t);
→ -1
defined(42);
→ -1
See
rvar;
voice.
|