IS FUNCTION()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to test whether a parameter passed to a function is itself a function or procedure

Syntax

IS_FUNCTION(<varname>)

See Also

CLASS EXISTS(), ENDFUNC, FUNCTION, FUNCTION_EXISTS(), ISSET(), PEXIST(), PROCEDURE, RETURN, SET LIBRARY, SET PROCEDURE, TYPE(), UNSET(), VARTYPE()

Description

The IS_FUNCTION() function can be used to check whether a parameter passed to a function is itself a function or procedure.

Example

function zzz()
	? "zzz function called"
endfunc
 
function xxx()
	? "xxx function called"
endfunc
 
function myspecialfunction(arg)
	if is_function(arg)
		arg()
	endif
endfunc
 
myspecialfunction(zzz)
myspecialfunction(xxx)