NATURAL

Natural is a fourth-generation programming language from Software AG. It is largely used for building databases output in plain text form, for example.

* Hello World in NATURAL WRITE 'Hello World!' END

It has the ESCAPE TOP flow control instruction, which is similar to continue in C, C++, Java and several other languages, except that it also works within subroutines to both return from the routine and then continue the calling statement's processing loop.

Like continue, it avoids large amounts of indentation levels when using nested instruction blocks inside any loop.

Example with ESCAPE TOP:

DEFINE DATA LOCAL 1 I (N3) /* 3 digits without decimals END-DEFINE FOR I = 2 TO 100 IF (I / 2 * 2) = I AND I > 2 WRITE 'Number' I 'is divisible by 2' ESCAPE TOP END-IF IF (I / 3 * 3) = I AND I > 3 WRITE 'Number' I 'is divisible by 3' ESCAPE TOP END-IF IF (I / 5 * 5) = I AND I > 5 WRITE 'Number' I 'is divisible by 5' ESCAPE TOP END-IF IF (I / 7 * 7) = I AND I > 7 WRITE 'Number' I 'is divisible by 7' ESCAPE TOP END-IF IF (I / 11 * 11) = I AND I > 11 WRITE 'Number' I 'is divisible by 11' ESCAPE TOP END-IF WRITE 'Number' I 'is prime' END-FOR END

The levels of indentation can be automatically adjusted with the STRUCT command in the Natural Editor.

The same example, without ESCAPE TOP:

DEFINE DATA LOCAL 1 I (N3) /* 3 digits without decimals END-DEFINE FOR I = 2 TO 100 IF (I / 2 * 2) = I AND I > 2 WRITE 'Number' I 'is divisible by 2' ELSE IF (I / 3 * 3) = I AND I > 3 WRITE 'Number' I 'is divisible by 3' ELSE IF (I / 5 * 5) = I AND I > 5 WRITE 'Number' I 'is divisible by 5' ELSE IF (I / 7 * 7) = I AND I > 7 WRITE 'Number' I 'is divisible by 7' ELSE IF (I / 11 * 11) = I AND I > 11 WRITE 'Number' I 'is divisible by 11' ELSE WRITE 'Number' I 'is prime' END-IF END-IF END-IF END-IF END-IF END-FOR END

Another powerful flow control instruction command is the ESCAPE BOTTOM, which is similar to ESCAPE TOP except that it continues the processing from end of the calling statement's processing loop. Example with ESCAPE BOTTOM:

DEFINE DATA LOCAL 1 I (N3) /* 3 digits without decimals END-DEFINE FOR I = 2 TO 100 IF (I / 2 * 2) = I AND I > 2 WRITE 'Number' I 'is divisible by 2' ESCAPE BOTTOM END-IF IF (I / 3 * 3) = I AND I > 3 WRITE 'Number' I 'is divisible by 3' ESCAPE BOTTOM END-IF IF (I / 5 * 5) = I AND I > 5 WRITE 'Number' I 'is divisible by 5' ESCAPE BOTTOM END-IF IF (I / 7 * 7) = I AND I > 7 WRITE 'Number' I 'is divisible by 7' ESCAPE BOTTOM END-IF IF (I / 11 * 11) = I AND I > 11 WRITE 'Number' I 'is divisible by 11' ESCAPE BOTTOM END-IF WRITE 'Number' I 'is prime' END-FOR END

One trait that sets Natural apart from most other languages is its rich syntax. For example, many languages have a simple switch case statement that can be used to replace nested IF statements pertaining to a single variable; in C-like languages, it is prone to logic errors since it is necessary to BREAK out of the statement programatically. Natural has a much cleaner/richer DECIDE statement which is easier to understand and code. Here is an example:

DECIDE ON FIRST VALUE MARITAL-STATUS VALUE 'M' DESC := 'Married' VALUE 'D' DESC := 'Divorced' VALUE 'W' DESC := 'Widowed' ANY ONCE-MARRIED := TRUE NONE DESC := 'Single' END-DECIDE

Other articles related to "natural":

Natural Capital
... Natural capital is the extension of the economic notion of capital (manufactured means of production) to goods and services relating to the natural environment ... Natural capital is thus the stock of natural ecosystems that yields a flow of valuable ecosystem goods or services into the future ... Natural capital may also provide services like recycling wastes or water catchment and erosion control ...
Fossil Fuel - Origin
... Petroleum and natural gas are formed by the anaerobic decomposition of remains of organisms including phytoplankton and zooplankton that settled to the sea (or lake ... Some fuels like natural gas, for instance, contain only very low boiling, gaseous components ... plants also form type III kerogen, a source of natural gas ...
Economy Of Turkey - External Trade and Investment
32% has been invested in Russia, primarily in the natural resources and construction sector, and 46% in Turkey’s Black Sea neighbours, Bulgaria and Romania ... due to the rising demand for energy resources like natural gas and crude oil ... Share of natural gas decreased from 74% in 1980 to 30% in 1990 and 12% in 2005 ...
Humanae Vitae - Summary - Appeal To Natural Law and Conclusion
... Public authorities should oppose laws which undermine natural law scientists should further study effective methods of natural birth control doctors should further familiarize themselves with this ... The encyclical closes with an appeal to observe the natural laws of the Most High God ...
Economy Of Ukraine - Natural Resources
... Ukraine is relatively rich in natural resources, particularly in mineral deposits ... Although oil and natural gas reserves in the country are largely exhausted, it has other important energy sources, such as coal, hydroelectricity and nuclear fuel raw materials ...

Famous quotes containing the word natural:

    What journeyings on foot and on horseback through the wilderness, to preach the gospel to these minks and muskrats! who first, no doubt, listened with their red ears out of a natural hospitality and courtesy, and afterward from curiosity or even interest, till at length there “were praying Indians,” and, as the General Court wrote to Cromwell, the “work is brought to this perfection that some of the Indians themselves can pray and prophesy in a comfortable manner.”
    Henry David Thoreau (1817–1862)

    This letter will be delivered to you by my child,—the child of my adoption,—my affection! Unblest with one natural friend, she merits a thousand. I send her to you innocent as an angel, and artless as purity itself; and I send you with her the heart of your friend, the only hope he has on earth, the subject of his tenderest thoughts, and the object of his latest cares.
    Frances Burney (1752–1840)

    Numerous studies have shown that those adults who feel the most frustrated by children—and the least competent as parents—usually have one thing in common.... They don’t know what behaviors are normal and appropriate for children at different stages of development. This leads them to misinterpret their children’s natural behaviors and to have inappropriate expectations, both for their children and themselves.
    Lawrence Kutner (20th century)