AND

Contents


and makes a “logic and” between two logic values.

Syntax

    exp1 and exp2

 

Parameters

Element

Description

Restrictions

exp1

expression_logique.

None.

exp2

expression_logique.

None.

Examples

 # Test : does I=1 and J=2 ?
  
If I = 1 and J = 2
       Infbox "Both conditions are met"
 Endif

  # Loop as long as integers I and J are non-null, avoiding an infinite loop.
  
If I < 0 and J < 0
       Infbox "I and J are negative ! The loop will be infinite !"
    Else
        While I and J
           I -= 1 : J -= 1  
       :# Decrement I and J
     
     Wend
 Endif

 

Description and comments

and gives a logic result (0->false, 1->true) dependent on two logic expressions having true (non null) or false (null) values, in accordance with the following truth table:

exp1

exp2

exp1 and exp2

FALSE
FALSE
TRUE
TRUE

FALSE
TRUE
FALSE
TRUE

FALSE (=0)
FALSE(=0)
FALSE (=0)
TRUE (=1)

 

Comment:

When a formula is entered containing an ‘and‘ in a process or a mask, for example, the keyword recognition phase replaces this keyword with the equivalent character ‘& ‘; thus you may write either:
exp1
and exp2
or exp1 & exp2

 

Associated errors

Error

Description

ERMODE (10)

The arguments are not numerical.

 

Associated key words

OR - XOR - NOT


CONTENTS


Copyright © Sage 1999 - 2007