If you always know that a certain condition (or expression) is going to be met - definately. And you can always add <cfdefaultcase></cfdefaultcase> for additional processing if needed. <cfswitch> is a good technique to use in this situation.
== Peter Tilbrook Macromedia ColdFusion Applications Developer 4/73 Tharwa Road Queanbeyan, NSW, 2620 AUSTRALIA Phone: (02) 6284 2727 Mobile: 0401 973 415 Email: [EMAIL PROTECTED] WWW: http://www.coldfusion.dns2go.com/ -----Original Message----- From: Vishal Narayan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 26 June 2002 5:50 PM To: CF-Talk Subject: <Cfswitch> <cfcase> vs. <elseifs> performancewise Our site has around15-20 different e-mails (all dynamically generated) that are triggered off based on different user actions, such as registration, unsubscribing etc. All the e-mails on our site are being sent out using one single template, i.e. the template is called using cfmodule with an attribute identifying the type of email, and any other attributes that may be required. A sample call may look like this : <cfmodule template="mailingtemplate.cfm" mailtype="FirstReg" cnd_id="#cnd_id#"> The template mailingtemplate.cfm looks like this : <cfset mailtype="#attributes.mailtype#"> <cfif mailtype is "NewCand"> <!--- Dynamically generate email and send it out---> <cfelseif mailtype is "FirstReg"> <!--- Dynamically generate email and send it out---> <cfelseif mailtype is "NewApply"> <!--- Dynamically generate email and send it out---> <cfelseif mailtype is "NewCandAdmin"> <!--- Dynamically generate email and send it out---> ----- and so on --- </cfif> This template may have about 15-20 else if conditions. Would there be any improvement in performance if we were to use <cfswitch> <cfcase> instead ? The template would then then look like this: <CFSWITCH mailtype="#attributes.mailtype#"> <CFCASE VALUE="NewCand"> <!--- Dynamically generate email and send it out---> </CFCASE> <CFCASE VALUE="FirstReg"> <!--- Dynamically generate email and send it out---> </CFCASE> -- and so on -- <CFDEFAULTCASE> <!--- Do nothing ---> </CFDEFAULTCASE> </CFSWITCH> Vishal. ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists