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

ListReduceRight

Last update:
May 18, 2026

Description

Iterates over each item of the list and calls the closure to work on the item. This function will reduce the list to a single value from right to left and will return the value.

Returns

Any

Syntax

ListReduceRight(list, callback, initialValue, [delimiter, includeEmptyFields])

History

ColdFusion (2021 release): Added this function.

Parameters

Parameter
Required/Optional
Description
array
Required
The input array.
callback
Required
Closure or a function reference that will be called for each of the iteration. The arguments passed to the callback are
  • result: result of the reduce operation after the previous iteration
  • item: item in the array
  • index : current index for the iteration
  • array : reference of the original array
initialValue
Optional
Initial value which will be used for the reduce operation. The type is any.
delimiter
Optional
The list delimiter. The type is string.
includeEmptyFields
Optional
(Boolean) Include empty values.

Example

<cfscript> 
    myList="2021, ColdFusion "; 
    closure=function(value1,value2){ 
             return (value1&value2); 
       } 
       writeOutput(ListReduce(myList,closure,"")); 
       writeoutput("<br>") 
       writeOutput(ListReduceRight(myList,closure,"")); 
</cfscript>

Output

2021 ColdFusion

ColdFusion 2021

Example- Member function

<cfscript> 
    myList="2021, ColdFusion "; 
    closure=function(value1,value2){ 
             return (value1&value2); 
       } 
      writeOutput(myList.ReduceRight(closure,"")); 
</cfscript>

Output

noisuFdloC ,1202

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