Remote-processing CAMBASIC Manuel d'utilisateur Page 16

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 208
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 15
Concepts - 10
> greater than X> Y
< less than X< Y
>= greater than X> = Y
or equal to
<= less than X< = Y
or equal to
Relational operations return a value of “0” if false, – “1” if true.
Logical Operators
Logical operators perform logical, or Boolean operations on numeric values. Just as relational operators usually make
decisions regarding program flow, logical operators usually connect two or mor e relations and return a true or false value
to be used in a decision (see “IF statement” in CAMBASIC COM MAN DS).
A logical operator takes a combination of true– false values and returns a true or false result. An operand of a logical
operator is considered “ true” if it is not equal to zer o (like the – 1 retur ned by a r elational oper ator), or “ false” if it is
equal to zero. T he result of the logical oper ation is a num ber which is, again, “tr ue” if it is not equal to zero, or “ false” if
it is equal to zero. T he number is calcu lated by per forming the operation, bit by bit.
The logical operators are NOT, AND, XOR and OR. In the following table. (“ T” indicates a true, or nonzero value.
“F” indicates a false, or zero value.). The operators are listed in order of precedence.
A NOT A A B A AND B
T F T T T
F T T F F
F T F T F
F F F F F
A B A OR B A B A XOR B
T T T T T F
T F T T F T
F T T F T T
F F F F F F
Logical operations are carried out on 16– bit operands with 16– bit results. The examples use 8– bit operands for
simplicity.
The OR operator essentially detects the presence of a binary “ 1” in either operand. For example:
Operand 1 0001 0111 = 23
Operand 2 0100 1010 = 74
Operand 1 0101 1111 = 95
OR Operand 2
The AND operator detects the coincidence of two binary “ 1”s.
Operand 1 0001 0111 = 23
Operand 2 0100 1010 = 74
Operand 1 0000 0010 = 2
Vue de la page 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 207 208

Commentaires sur ces manuels

Pas de commentaire