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     
Paradox OPAL: Language Basics:
ObjectPAL End of Statement (whitespace)
Posted 13 years ago on 12/14/2008 and updated 1/19/2009
Paradox Code Snippet:
 A flashcard from our Paradox Flashcards Library
 A code snippet from our Paradox Code Snippets Page


Languages Focus: End of Statement

In coding languages, common End of statement specifiers include a semicolon and return (others exist too). Also of concern when studying a language is can you put two statements on a single code line and can you break a single statement into two or more code lines.

ObjectPAL End of Statement

ObjectPAL is a bit unique in that it doesn't use a semicolon nor a return to mark the end of a line, it uses whitespace which can be a return, space, or tab. This is a bit unusual but does allow for some nice formatting of code.

Syntax Example:
msgInfo("", "Hello1")
msgInfo("", "Hello2")
msgInfo("", "Hello3")

;The following single line of code also works.
msgInfo("", "Hello4") msgInfo("", "Hello5")

;Two or more works too:
("", "Hello6")


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

It's not so much that ObjectPAL uses whitespace instead of a semicolon or a return to mark the end of a statement, as that ObjectPAL doesn't mark the end of a statement at all.

It's up to the programmer to use white space and new lines to make his code clear.  The ObjectPAL parser doesn't care.

Advanced question: given that f(p) is defined as

proc f(const p longint) longint
   return p + p

what will this code do

   x = 7 + f(3)
   y = 7 - f(3)
   z = 7   f(3)



Posted 10 years ago

Comment 2 of 4

Without typing it in, let me try a guess. First, is this a trick question? Did you mean to make the p parameter a const? If so, then what happens is an error.

As for the z example, z will equal 7 and because of the whitespace the "f(3)" is considered a new line of code that in this case does nothing.

Off to Paradox...ok, I was right. What do I get? Laughing

here's a working version:

proc f(const p longint) longint
   return p + p
method pushButton(var eventInfo Event)
  x,y,z LongInt
  a LongInt
 a = 3
 x = 7 + f(a)   
 msgInfo("", x)   ;display 13.
 y = 7 - f(a)
 msgInfo("", y)  ;display 1.
 z = 7   f(a)
 msgInfo("", z) ;display 7, f(3) does nothing.
Posted 10 years ago

Comment 3 of 4

Correct as always, Mike.

(1) The "const" is an error.  The line should be

proc f(p longint) longint

This wasn't a trick, just a coding error.  Sorry.

(2) Right.  The result of "f(3)" is ignored.  If you encounter a line like this, not in the context of discussing statement-endings, especially after trying to code, say, "z = 7 + f(3)", you may become very confused for a long time.  Guess how I know this.

(3) You get to write another book!  A collection of bizarre and confusing errors in the most popular languages.  You could call it "Unsafe in Any Language".


Posted 10 years ago

Latest Comment
Comment 4 of 4

>>(2) Right. The result of "f(3)" is ignored.

Yeah! I got it right! The book idea is a good one. I like the title too. I have a few books I'm in the middle of and hope to publish later this year.

Posted 10 years 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 = P1182A1
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 Intermediate Level Question

Question #1: True or False?

It is legal to put two code statements on a single line as in the following:

msgInfo("", "hello")  msgInfo("", " world")
  • True
  • False

  •  KB Article #101694 Counter
    Since 12/14/2008
    Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

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