Comments

Commenting in ColdFusion is different most other languages. The comment is very much like the HTML comment, but that extra – is super important. Don’t forget it. The ColdFusion comment doesn’t validate in HTML either, so be sure to not to use the ColdFusion comment on strictly HTML pages. I wish circumstances where different and Adobe choose a different commenting style, but that is the hand we are dealt. Always try to comment your work about every 30 lines or so you can remember what the following code does. It’s often a great idea to comment every function. Also, you make it easier for everyone else to figure out what you are doing and why. Like I said try for at least every 30 lines, but comment more when you are dealing with some complex code. One of the best pieces of information I acquired from digging through a previous developers work is that comments are always accurate. Whenever you update a piece of code in ColdFusion, make sure you update the comment too.

Example

Result

No, it didn’t

So, in this example we had <!—ColdFusion Wrote me—> that was a comment, and it is on the server side. This means you will not see the comment at all on the client side. Thank goodness for that because we surely wouldn’t want people to search through our source code and find our deepest commented secrets. Finally, the only text that actually shows up on the client side is the No, it didn’t, which is exactly what we wanted.

If you enjoyed this resource, support me by sharing this page with others.
Share on Facebook
Facebook
Share on Google+
Google+
Share on StumbleUpon
StumbleUpon
Digg this
Digg
Tweet about this on Twitter
Twitter
Share on Reddit
Reddit

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.