On Sunday, September 8, 2002, at 09:33 , Joe Eugene wrote: > I dont agree with Sean or Dave...
That doesn't surprise me Joe :) > i dont think IIF is necessary but its > a very useful function ... "IF USED PROPERLY" I didn't say it wasn't *useful* - I just said it was bad practice and could always be avoided. > Many of you guys dont agree.. but i personally prefer using IIF and i > use it only when necessary... a good example would be...table row colors. > .. It is NEVER necessary. You even admit that above! > i dont use the above for complex logic...write cfscript blocks of code... > i am not very fond of <cfif> contructs... But you can structure your code to be concise without iif(). Since you want alternating colors, you should see that rownum mod 2 will give alternating 1, 0, 1, 0 values. So you could construct a two-element array containing the colors you want - do this above the loop over the table rows - and then each row just accesses the appropriate element of the array. The main benefit of this approach is that it keeps the color specification separate from the row logic instead of being embedded in the table and it also scales easily to alternately through more colors or alternating on blocks of rows. And of course it doesn't use iif() which is a big plus in my book. If you want to use iif() instead of <cfif>, that's up to you. Just don't ask me for a job (or a reference)... :) Sean A Corfield -- http://www.corfield.org/blog/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com 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