home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / arrayset.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  929 b   |  35 lines

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