How to add an element at the end of an array in ColdFusion

ArrayAppend() - add an element at the end of an array

ArrayAppend.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayAppend function example: how to add element at the end of an array</title>
</head>

<body>
<h2 style="color:Green">ArrayAppend Function Example</h2>

<cfset ColorArray = ArrayNew(1)>
<cfset Temp=ArrayAppend(ColorArray,"AliceBlue")>
<cfset Temp=ArrayAppend(ColorArray,"AntiqueWhite")>
<cfset Temp=ArrayAppend(ColorArray,"Aqua")>
<cfdump var="#ColorArray#" label="Color Array">
<br />

<b>Now Append: Aquamarine</b>
<br />
<cfset Temp=ArrayAppend(ColorArray,"Aquamarine")>
<cfdump var="#ColorArray#" label="Color Array">

</body>
</html>





More ColdFusion examples