home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / arraynew.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  852 b   |  33 lines

  1. <!--- This example shows ArrayNew --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayNew Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY>
  8. <H3>ArrayNew Example</H3>
  9.  
  10. <!--- Make an array --->
  11. <CFSET MyNewArray = ArrayNew(1)>
  12. <!--- Note that ArrayToList will not function properly
  13. if the Array has not been initialized with ArraySet --->
  14. <CFSET temp = ArraySet(MyNewArray, 1,6, "")>
  15.  
  16. <!--- set some elements --->
  17. <CFSET MyNewArray[1] = "Sample Value">
  18. <CFSET MyNewArray[3] = "43">
  19. <CFSET MyNewArray[6] = "Another Value">
  20.  
  21. <!--- is it an array? --->
  22. <CFOUTPUT>
  23.     <P>Is this an array? #IsArray(MyNewArray)#
  24.     <P>It has #ArrayLen(MyNewArray)# elements.
  25.     <P>Contents: #ArrayToList(MyNewArray)#
  26. <!--- Note that the array has expanded dynamically
  27. to six elements with the use of ArraySet, even though
  28. we only set three values --->    
  29.  
  30. </CFOUTPUT>
  31. </BODY>
  32. </HTML>       
  33.