Difference between revisions of "LEVEL()"

From Lianjapedia
Jump to: navigation, search
(Example)
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
  
 
==Description==
 
==Description==
The LEVEL() function returns the 'do' level of the currently executing program or procedure.  Issued at the command prompt, the LEVEL() function returns 0.  Issued in a master or calling program, LEVEL() returns 1.  Subsequent called programs or procedures are at a 'do' level based on the program nesting.
+
The LEVEL() function returns the 'do' level of the currently executing program or procedure.  Issued at the command prompt, the LEVEL() function returns 1.  Issued in a master or calling program, LEVEL() returns 2.  Subsequent called programs or procedures are at a 'do' level based on the program nesting.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 
> ? level()
 
> ? level()
         0
+
         1
 
//master.prg
 
//master.prg
 
procedure subproc1
 
procedure subproc1
Line 25: Line 25:
 
//end of master.prg
 
//end of master.prg
 
> do master
 
> do master
        1
 
 
         2
 
         2
 +
        3
 
</code>
 
</code>
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 09:06, 1 December 2021

Purpose

Function to return the 'do' level of the currently executing program or procedure

Syntax

LEVEL()

See Also

DO, DOLEVEL(), PATH(), PROCLIBS(), PROCLINE(), PROCNAME(), PROGRAM(), SYS()

Description

The LEVEL() function returns the 'do' level of the currently executing program or procedure. Issued at the command prompt, the LEVEL() function returns 1. Issued in a master or calling program, LEVEL() returns 2. Subsequent called programs or procedures are at a 'do' level based on the program nesting.

Example

> ? level()
         1
//master.prg
procedure subproc1
? level()
?
return
 
? level()
subproc1()
//end of master.prg
> do master
         2
         3