Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what do i use cfscript for?

Status
Not open for further replies.
Aug 18, 2003
111
0
0
GB
What do i use cfscript for?

I use coldfusion mx but have never used cfscript before. is there anything that cfscript does better than cftags or is it just preference.
 
cfscript is cool. You use it to create a user defined function.

here is a cool example of how to use it.

thread232-930499

funny thing. after i wrote it and posted this thread, i found almost the exact same thing in the CF developers exchange site. been there for a while. oh well :)

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
You can also use it for config setups.. I've seen that somtimes.. to emulate the look of the php config files..

Cfscript won't do anything for you that you can't do in code, so don't think your life depends on learning it, but yeah, as you get the time, learn it.

It basically gives developers of other languages a familiar playground.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Reasons I use cfscript:

1. To inialize, check, validate, and default a lot of incoming variables at once.
2. For UDFs.
3. If the code has a lot of ifs, loops, or arrays and very little cf tags.

The only real reason I use cfscript is to type less, and sometimes less characters on the screen makes the code seem a little easier to read.

Kris


Kris Brixon

Don't ever take a fence down until you know why it was put up.
--Robert Frost
 
cfscript is supposed to be faster at proccessing large amounts of logic where little or no output is required. I generaly use ut if I have more then a 5 or 10 lines of code with no output.

I use it almost exclusivly while validating form data where there might be lots of ifs





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top