Traditionally, since a switch statement has a specific
purpose, you can eliminate (at the interpreter/compiler level)
some of the overhead of doing an if check.
In C for certain switch statements are faster than other
forms of conditional logic for achieving the
if
elseif
elseif
else
logical structure. :)
CFSWITCH is okay
Jeremy Allen
ElliptIQ Inc.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 17, 2000 9:46 AM
To: CF-Talk
Subject: RE: Bad Coding Ethic.....
The reasons I would use CFSWITCH:
1) Clear from the fact you're using CFSWITCHthat the choice depends entirely
on the value of the one variable ->quicker comprehension by someone reading
the code.
2) Supposedly, marginally better performance.
In fact, I rarely use CFSWITCH because the CFCASE values cannot be
variables. I like to put the sort of "magic values" often found in CFSWITCH
situations into variables with a meaningful name and would use constants if
they existsed.
-----Original Message-----
From: Michael Thomas [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 17, 2000 9:25 AM
To: CF-Talk
Subject: Bad Coding Ethic.....
Ive heard numerous times that it is bad coding ethic to reference a variable
that has been set multiple times depending on certain conditions, per se in
the setting of a message. This why they have created SWITCH/CASE. My
question is if any one can give me an explanation of "why is this bad coding
ethic???"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists