Description

Determines whether a value or expression references a function defined via a function expression, as opposed to a function statement.

Returns

True, if the value represents a function expression; otherwise False.

Category

Syntax

isClosure(object)

See also

History

ColdFusion (2018 release): Introduced named parameters.

ColdFusion 10: Added this function.

Parameters

Parameter

Description

object

A value.

Usage

Use this function to determine whether the value or expression represents a function defined via a function expression.

Example

 

<cfscript>
// Non-closure
function1 = 'Hello_World';
writeoutput("Is it closure: " & isClosure(function1) & "<br>");

// Closure
function2 = function () {};
writeoutput("Is it closure: " & isClosure(function2));
</cfscript>

Output

Is it closure: NO
Is it closure: YES

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy