How to perform index loop in ColdFusion

cfloop - index loop

cfloopindex.cfm



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to use index loop in coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: index</h2>

<cfoutput>
    <b>Loop start[1 to 10]....</b><br />
    <cfloop from="1" to="10" index="Counter">
        Current position: #Counter#<br />
    </cfloop>
    <b>Loop End....</b><br />

 <br /><br />
    
    <b>Loop start[1 to 10; step 2]....</b><br />
    <cfloop from="1" to="10" step="2" index="Counter">
        Current position: #Counter#<br />
    </cfloop>
    <b>Loop End....</b><br />
    
</cfoutput>
</body>
</html>







More ColdFusion examples