Whatever message this page gives is out now! Go check it out!

count

Last update:
Jun 9, 2026
Returns the number of distinct elements in the set; often an alias of size().

Description

Member method count() reports the same cardinality as size() in APIs that offer both (for example Java-style naming). If only one of the two exists in your ColdFusion build, use that one consistently.

Returns

Non-negative numeric (integer).

Category

ColdFusion Set member methods

Function syntax

set.count()

Parameters

ParameterDescription
None.

See also

Example

Starter example in cfscript (uncomment count() if your build supports it).

<cfscript>
    s = setNew();
    writeOutput(s.size()); // 0

    s.add("a");
    s.add("b");
    writeOutput(s.size()); // 2

    // If supported as an alias:
    writeOutput(s.count());
</cfscript>
      

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page