ColdFusion
  Home arrow ColdFusion arrow Page 3 - What You Must Know About Operators in Cold...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
COLDFUSION

What You Must Know About Operators in ColdFusion!
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 7
    2005-08-22

    Table of Contents:
  • What You Must Know About Operators in ColdFusion!
  • Conditional Operators
  • Logical Operators
  • String Operator

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    What You Must Know About Operators in ColdFusion! - Logical Operators


    (Page 3 of 4 )

    Operator Truth Table/Description
    NOT Negates the argument.
    If argument is 'true', it produces 'false',
    and vice versa
    AND
    OR
    XOR (Exclusive or)
    EQV (Equivalence)
    IMP (Implication))
    Code example

    An example with all the operators is shown in the code below, followed by the result of browsing the file. Since the logical operators operate on Boolean operands, it can be seen that the Boolean results obtained by using the conditional operators can be combined using the Boolean operators to evaluate complex conditions (for example, to flag a person based on sex, salary level, and marital status to pick up a certain tax rate range).

    logical2.cfm
    <cfscript>
    YES=TRUE;
    NO=FALSE;
    WriteOutput("<br><h4>Test Boolean evaluations</h4>");
    WriteOutput("<b>-----OR-----</b><br/>");
    WriteOutput("[TRUE] <b>OR</b> [FALSE] is :  " & Evaluate(True OR False));
    WriteOutput("<p></p>");
    WriteOutput("<br><b>-----AND-----</b><br/>");
    WriteOutput("[TRUE] <b>AND</b> [FALSE] is :  " & Evaluate(True AND False));
    WriteOutput("<p></p>");
    WriteOutput("<br><b>-----XOR-----</b><br/>");
    WriteOutput("[TRUE] <b>XOR</b> [FALSE] is :  " & Evaluate(True XOR False));
    WriteOutput("<p></p>");
    WriteOutput("<br><b>-----EQV-----</b><br/>");
    WriteOutput("[TRUE] <b>EQV</b> [FALSE] is :  " & Evaluate(True EQV False));
    WriteOutput("<p></p>");WriteOutput("<br><b>-----IMP-----</b><br/>");
    WriteOutput("[TRUE] <b>IMP</b> [FALSE] is :  " & Evaluate(True IMP False));
    </cfscript>
    

    Result of evaluation:

    More ColdFusion Articles
    More By Jayaram Krishnaswamy


       · Sitting at an undetermined distance from the readers, the single, most important...
     

    COLDFUSION ARTICLES

    - How to Access a SQL Anywhere Database with C...
    - CFXML: Probing XMLDOM in ColdFusion
    - Creating a Web Service with ColdFusion: the ...
    - CFAjax: What it is and How to Use it
    - Querying SQL 2000 Server from ColdFusion
    - Introduction to ColdFusion Markup Language, ...
    - Introduction to ColdFusion Markup Language
    - Databases and Dreamweaver MX 2004, concluded
    - Databases and Dreamweaver MX 2004
    - Welcome to Coldfusion MX 6.1, concluded
    - Welcome to Coldfusion MX 6.1
    - What You Must Know About ColdFusion Flow-Con...
    - What You Must Know About Operators in ColdFu...
    - Everything You Must Know About ColdFusion Va...
    - My First Application on ColdFusion MX Server






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT