ColdFusion CFscript - Create custom function in script

cfscript - create, call and use function

cfscriptFunction.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 create, call and use function in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: create function</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<h3 style="color:CornflowerBlue;">
 <cfscript>
  function hello (userName){
   sayHello = "Hello #userName# !";
   return sayHello;
   }
  WriteOutput("#hello("Jones")#");
    </cfscript>
</h3>

</body>
</html>






More ColdFusion examples