Home / Articles / Adobe ColdFusion / Conditional Processing in Macromedia ColdFusion MX 7

Conditional Processing in Macromedia ColdFusion MX 7

Chapter Description

Conditional processing allows ColdFusion to code interactive documents that can react and adapt to input and environments and offer feedback to end users. This chapter covers conditional processing with an eye toward passing the Certified ColdFusion Developer exam.

Summary

Conditional processing is essential in the development of ColdFusion applications, and several tools are available to help you use it. <cfif> is often the best tool, but <cfswitch> is easier to read and performs better under certain circumstances.

Sample Questions

  1. Which operators are used to test for equality? (select two)
    1. ==
    2. IS THE SAME AS
    3. IS
    4. =
    5. EQ
  2. Which of the following is logically equivalent to TRUE? (select all that apply)
    1. -1
    2. ON
    3. 1
    4. YES
  3. What output would the following code generate?
    <cfset name="Ben">
    <cfswitch expression="name">
     <cfcase value="Ben">
     Hello Ben.
     </cfcase>
     <cfcase value="Angela">
     Hello Angela.
     </cfcase>
     <cfcase value="Jeff">
     Hello Jeff.
     </cfcase>
     <cfdefaultcase>
     I have no idea who you are.
     </cfdefaultcase>
    </cfswitch>
    
    1. Hello Ben.
    2. Hello Angela.
    3. Hello Jeff.
    4. I have no idea who you are.