DaniWeb IT Discussion Community

Code Snippets (http://www.daniweb.com/code/)
-   coldfusion (http://www.daniweb.com/code/coldfusion.html)
-   -   Simple starter cf45 application (http://www.daniweb.com/code/snippet126.html)

mikeandike22 coldfusion syntax
Dec 23rd, 2004
this application shows you how to declare variables and display variables. the end result of this code is showing you the total price after tax. this is mainly for beginners.

  1. <cfset nTax = .05 />
  2. <cfset nPrice = 5.95 />
  3. <cfset nTotal = nTax * nPrice + nPrice />
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <title>Variables</title>
  9. </head>
  10.  
  11. <body>
  12. <cfoutput>Price: #nPrice#</cfoutput><br>
  13. <cfoutput>Tax: #nTax#</cfoutput><br>
  14. <cfoutput>Total: #nTotal#</cfoutput>
  15.  
  16.  
  17. </body>
  18. </html>