ColdFusion CFscript - Create an array in script

cfscript - array in script

cfscriptArray.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to create and use array in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: Array</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfscript>
 ColorArray = ArrayNew(1);
 temp = ArrayAppend(ColorArray,"Crimson");
 temp = ArrayAppend(ColorArray,"Red");
 temp = ArrayAppend(ColorArray,"SeaGreen");
 temp = ArrayAppend(ColorArray,"OrangeRed");
</cfscript>

<cfif IsDefined("ColorArray")>
 <cfdump var="#ColorArray#">
</cfif>

</body>
</html>





More ColdFusion examples