cfscript - while loop in script
cfscriptWhile.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to use while loop in cfscript</title>
</head>
<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: while loop</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />
<b>
<cfscript>
counter = 1;
while(counter LTE 5){
WriteOutput("Counter Now: #counter# <br />") ;
counter = counter+1;
}
</cfscript>
</b>
</body>
</html>
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5xDO-pO8voZqX2RfMmX5ob9Ra66Mn0jLELyiPFW5MquM42waMH8bMcFqnmh7q4XBl9LE3Qt8DBPMa8I4qauLIKPYNBKZky92p1lCQf359oszTSa2DLEr5gEaDZc3GgHsl3np1IYQKdxk/s1600/cfscriptWhileLoop.gif)
- cftry and cfcatch - catch exception and handle error
- cfdiv
- cfscript - array in script
- cfscript - if else conditional statement in script
- cfscript - structure in script
- cfscript - switch, case, default statement in script
- cfscript - call user defined function (UDFs) in script
- cfscript - for loop in script
- cfscript - create, call and use function in script