Logical operators

 BBS: Inland Empire Archive
Date: 04-03-92 (18:12)             Number: 67
From: JIM WELLS @ 930/21           Refer#: NONE
  To: BILL WHITE                    Recvd: NO  
Subj: Logical operators              Conf: (2) Quik_Bas
BW>     I knew there were 6 logical operators, but it took
BW>me a while to figure out that you left out NOT!  Its use
BW>is obvious.

BW>     Could you shed some light on IMP?  I see how to use
BW>the others, but how is IMP used?  I've never seen it used
BW>(so maybe it isn't!)

BW>              The Bill White in Miami, FL

  IMP, Bill, is both a logical and arithmatic operator. Its
logical function returns a value of false (0) only if its
first operand is true and its second operand is false.

  Here's a truth table for it:

        x        y        xIMPy
        1        1          1
        1        0          0
        0        1          1
        0        0          1

  IMP stands for implication as in a statement is TRUE if
the value of the first operand implies the value of the

  IMP accepts single and double precision operands but it
converst them to integer or long integers before processing
and the normal QB limits for those variable types apply.

  Its arithmatic use is pretty rare but can be seen in the
following statement:

       answer = xIMPy

      answer will equal 1 (true) according to the truth table above.

  IMP is a really useful operator for two variable
comparisons and I think it's more machine efficent than an
if then else clause.


 * SLMR 2.1 * Press "+" to see another tagline.

--- InterPCB 1.50
 # Origin: CENTRAL BBS -Texas' BEST BBS! 214-393-7090 HST  3+GIGs (8:930/21)
 * Origin: Gateway System to/from RBBS-NET (RBBS-PC 1:10/8)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET