ColdFusion CFscript - Assign variable in script

cfscript - assign variable in script

cfscriptAssignVariable.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 assign variable in cfscript tag</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript tag example: assign variable</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfscript>
 firstNumber = 10;
 secondNumber = 5;
 sum = firstNumber+secondNumber;
 WriteOutput("<h3 style='color:Crimson; font-weight:bold'>");
 WriteOutput("Sum of two numbers [10+5]: ");
 WriteOutput(sum); 
 WriteOutput("</h3>");
</cfscript>

</body>
</html>






More ColdFusion examples