document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <cfset arr = listToArray("1,2,3,4,5") />
  2.  
  3. <cffunction name="displayData">
  4.     <cfoutput>
  5.         Displaying array values.<br/>
  6.     </cfoutput>
  7.     <cfloop index="loopcount" from=1 to=5>
  8.         <cfoutput>
  9.             #arr[loopcount]#<br>
  10.         </cfoutput>
  11.     </cfloop>
  12.     <cfoutput>
  13.         Done. <br/>
  14.     </cfoutput>
  15. </cffunction>
  16.  
  17. <cffunction name="updateData">
  18.     <cfset indexNumber=3 /> <!--- assume input value = 1 --->
  19.     <cfoutput>
  20.         Array index to be edited= #indexNumber#<br/>
  21.     </cfoutput>
  22.     <cfset arrayValue=4 /> <!--- assume input value = 2 --->
  23.     <cfoutput>
  24.         New Value= #arrayValue#<br/>
  25.     </cfoutput>
  26.     <cfset arr[indexNumber] = arrayValue />
  27. </cffunction>
  28.  
  29.  
  30.  
  31.     <cfset userOption=2>
  32.     <cfloop condition="userOption gt 0">
  33.         <cfoutput>
  34.             ------------------------------------------------ <br/>
  35.             Options: 1-Display Data | 2-Update Data | 0-Exit <br/>
  36.             Enter your option:
  37.             #userOption# </br>
  38.         </cfoutput>
  39.        
  40.         <cfswitch expression="#userOption#">
  41.             <cfcase value="0">
  42.                 Bye <br/>
  43.             </cfcase>
  44.             <cfcase value="1">
  45.                 <cfoutput>
  46.                     #displayData()#
  47.                 </cfoutput>
  48.             </cfcase>
  49.             <cfcase value="2">
  50.                 <cfoutput>
  51.                     #updateData()#
  52.                 </cfoutput>
  53.             </cfcase>
  54.         </cfswitch>
  55.        
  56.         <cfset userOption--> <!--- assume that input value is decremented --->
  57.     </cfloop>
');