ColdFusion variables typeless feature

ColdFusion Variables are typeless

TypelessVariables.cfm


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>ColdFusion Variables are typeless - how to test variables typeless feature</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">ColdFusion Variables are typeless example: how to verify</h2>
<hr width="600" align="left" color="DarkSeaGreen" />
<br />

<cfset TestNumber=5>

<cfset TestString="20">
<cfset SampleMath=TestNumber*TestString>
<cfset SampleString="First Number: " & TestNumber & " Second Number: " & TestString>

<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed">
 <tr style="background-color:Crimson; color:Snow; font-size:large;">
     <td>Variable=Value</td>
     <td>Output</td>
    </tr>
 <cfoutput>
        <tr style="background-color:HotPink; color:Snow;">
            <td>TestNumber=5</td>
            <td>#TestNumber#</td>
        </tr>
        <tr style="background-color:HotPink; color:Snow;">
            <td>TestString="20"</td>
            <td>#TestString#</td>
        </tr>
        <tr style="background-color:HotPink; color:Snow;">
            <td>SampleMath=TestNumber*TestString</td>
            <td>#SampleMath#</td>
        </tr>
        <tr style="background-color:HotPink; color:Snow;">
            <td>SampleString="First Number: " & TestNumber & " Second Number: " & TestString</td>
            <td>#SampleString#</td>
        </tr>
 </cfoutput>    
</table>

</body>
</html>







More ColdFusion tutorials