I l @ ve RuBoard |
<CFLOOP>Used to repeat a specific piece of code over and over while certain conditions are met. SyntaxFor Index Loop: <cfloop index="name_of_index" from="value_to_start_on" to="value_to_end_on"> Code to be executed </cfloop> For List Loop: <cfloop index="name_of_index" list="name_of_list" delimiters="character_used_for_delimiter"> Code to be executed </cfloop> Other types of loops include conditional loops and loops over queries. AttributesIndex: Required. In an index loop, the index is a ColdFusion variable that holds the current place in the loop, starting at the From value and adding 1 for each iteration of the loop. In a list loop, the Index attribute holds the value of the current item in the list. If you are on the third iteration of the loop, it will hold the value of the third item in the list. From: Required. The number on which to start the loop. To: Required. The number on which to end the loop. Delimiters: Optional. The character used to separate the values in the list. The default is a comma. ExampleIndex Loop: <!--- use looping to count to 10 ---> <cfloop from="1" to="10" index="i"> <cfoutput> #i#<br> </cfoutput> </cfloop> List Loop: <!--- looping to loop over a list and output each value ---> <cfloop list="#url.list#" delimiters="," index="i"> <cfoutput> The current value in the list is: #I#<br> </cfoutput> </cfloop> |
I l @ ve RuBoard |