I have a problem with my cfml code. The ListAppend() function doesn’t seem to be working.
Here is the code in my .cfm page:
<cfset fruitList="apple, orange, banana">
<cfoutput>
fruitList before: #fruitList#<br>
</cfoutput>
<cfset temp = ListAppend(fruitList, "kiwi")>
<cfoutput>
fruitList after: #fruitList#<br>
</cfoutput>
But I always get this output:
fruitList before: apple, orange, banana
fruitList after: apple, orange, banana
The same goes for ListPrepend() and ListInsertAt(). Why does this happen?
Any help is appreciated.
listAppend() returns the new list (lists are nothing but strings, which ColdFusion passes by value) so in order for you to see appended value, you would need to use: