Examples
Here is the console version of a Hello world program:
PROC main: PRINT "Hello World!" PAUSE 40 ENDPAnd here is a GUI version for Nokia's Series 80 user interface:
CONST KKeyEnter%=13 PROC hello: dINIT "Hello" dTEXT "","Hello World!" dBUTTONS "OK",KKeyEnter% DIALOG ENDPOPL is a structured programming language. OPL programs contain PROCedures, which are much like functions in other programming languages.
- The dINIT keyword in this example initializes a dialog box (intuitively enough, all dialog-box related functions begin with a letter 'd'; for clarity, this letter is in lower case, but the language is case independent). The first argument of the dialog is an optional string, which is used for the title of the dialog, displayed in the title bar.
- The dTEXT function displays text, with two compulsory arguments: a left-aligned 'prompt' string, and a main string.
- The dBUTTONS keyword allows you to put buttons on the dialog box - here there is a button with the text "OK". The second argument to each button is both the special notation of the shortcut key for that button and the dialog's return code, in this case the "Enter" key.
- Finally, the DIALOG keyword is required for the previously initialized dialog box to be shown on the screen.
Read more about this topic: Open Programming Language
Famous quotes containing the word examples:
“There are many examples of women that have excelled in learning, and even in war, but this is no reason we should bring em all up to Latin and Greek or else military discipline, instead of needle-work and housewifry.”
—Bernard Mandeville (16701733)
“It is hardly to be believed how spiritual reflections when mixed with a little physics can hold peoples attention and give them a livelier idea of God than do the often ill-applied examples of his wrath.”
—G.C. (Georg Christoph)
“No rules exist, and examples are simply life-savers answering the appeals of rules making vain attempts to exist.”
—André Breton (18961966)