Your full service technology partner! 
-Collapse +Expand
Search Paradox Group:

-Collapse +Expand Paradox To/From
-Collapse +Expand Paradox Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Langua...   Print This     
  From the January 2016 Issue of Prestwood eMag
Paradox OPAL: Language Basics:
ObjectPAL Logical Operators
Posted 12 years ago on 2/12/2009 and updated 9/19/2009
Paradox Code Snippet:
 A flashcard from our Paradox Flashcards Library
 A code snippet from our Paradox Code Snippets Page


Languages Focus: Logical Operators

Logical operators perform conditional and, or, and not operations. Some languages support both binary logical operators that link two and unary logical operators negate (make opposite) the truth value of its argument. Finally, some languages short circuit logic. For example, with this or that, if this is an expression returning true, then that is never executed.

ObjectPAL Logical Operators

ObjectPAL logical operators:

and and, as in this and that
or or, as in this or that
Not Not, as in Not This

Like VBA, ObjectPAL never short circuits. Given the expression this or that as well as this and that, if this evaluates to false, then that is still executed.

Syntax Example:
;Given expressions a, b, c, and d:
if Not (a and b) and (c or d) then
  ;Do something.

Simple Short Circuit Code Test

The following code snippet allows you to test out ObjectPAL's short circuiting. In the if statement of the pushButton event, the That() custom procedure executes even if This() is False.

To use the code, alter a pushButton event of a button as follows:

;This custom procedure.
proc This() Logical
  msgInfo("", "This")
   return False
;That custom procedure.
proc That() Logical
  msgInfo("", "That")
   return True
method pushButton(var eventInfo Event)
   ;Object always short circuits.
   ;The That() custom procedure executes even 
   ;though This() returns false.
   if This() and That() then
     msgInfo("", "both are true")

Using the Logical Not Operator

You can use the not operator in many contexts. One of my favorite uses for it is to toggle boolean properities with a single line of code:

BooleanProperty = Not BooleanProperty

Working Paradox Demo

The following demo works in all versions of Paradox for Windows. The demo uses the not operator to toggle the visible property of a box from a button.

  1. Create a new form and place a button and a box on it.
    Paradox form.
  2. Name the box "TheBox". To rename it, select the box, right click and click properties. In the Name of object field, change the name to MyBox.
    Demo of using not operator.
  3. Edit the pushButton event and alter it as follows below. Select the button, right click, click Object Explorer. Double click the pushButton event on the Events tab.
    method pushButton(var eventInfo Event)
      TheBox.Visible = Not TheBox.Visible

  4. Run the form and test. Select Program | Run and click the button. You'll notice the visible box toggles between visible and not visible with a single line of code.

More Info


Share a thought or comment...
Comment 1 of 1

These operators play an important role in the way they just make the things better. I always do such experiments with the blogs tomake the codes remember by myself. Any ways it was such an aersome kind of tutorial for me.

Posted 18 months ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1215A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.


1 Beginner Level Question

Question #1: Multiple Choice

What are the logical operators?

  • and
  • or
  • not
  • and
  • or
  • not
  • xor
  • and
  • andAlso
  • or
  • orElse
  • not
  • and
  • andAlso
  • or
  • orElse
  • not
  • xor

 KB Article #101898 Counter
Since 2/12/2009
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2021 Prestwood IT Solutions.   [Security & Privacy]