• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
      • Procedural Sections
      • Logic
      • Language Elements
        • Version
        • Delimiters
        • Comments
        • Preprocessor
        • Variables and Constants
        • Expressions
        • Operators
          • Operators
          • String Comparisons
          • In Operator
          • Has Operator
          • If and Only If Operator
          • Operator Precedence
          • And/Or Truth Table
        • Files
        • Miscellaneous
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

If and Only If Operator

This operator has the following truth table:
if and only if (X <=> Y)
Y
Xtruefalse
truetruefalse
falsefalsetrue
The following two sets of code give the same result:
if ( SEX = 2 and AGE >= 10 ) <=> ( CHILDREN_BORN <> notappl ) then
   
errmsg("Children ever born incorrect");
endif;
and:
if SEX = 2 and AGE >= 10 then

   
if CHILDREN_BORN = notappl then
       
errmsg("Children ever born incorrect");
   
endif;

else
   
if CHILDREN_BORN <> notappl then
       
errmsg("Children ever born incorrect");
   
endif;

endif;
See also: Operators, Operator Precedence