Tagless If Statements

is used to implement conditional processing, but sometimes having to use sets of tags can break up the flow of an operation, as in this example:. To simplify this type of coding, consider using the IIf() function which essentially is a / implemented in a function (instead of tags). IIf() takes three parameters, the condition to evaluate (what would usually be passed to ), the TRUE result, and the FALSE result (what would usually be specified in the block). So, the IIf() version of the previous statement would simply be: . IIf() can be used anywhere an expression would be used, including tag attribute values. (Applies to: ColdFusion 3 (or later))

Leave a Reply