REBOL for COBOL programmers

Go to table of contents Go to feedback page


Date written: March 18, 2013
Date revised:
Date reviewed:

This page explains some REBOL equivalents of ADD.


The intention behind COBOL seems to have been to make a program read like plain English. Thus you have statements like

ADD identifier-1 TO identifier-2.
ADD identifier-1 TO identifier-3 GIVING identifier-3.

The REBOL equivalent

REBOL also has an "add" function. Being a function, it returns a value, so you have to use that value in an expression or capture it somehow.

identifier-2: add identifier-1 identifier-2
identifier-3: add identifier-1 identifier-2  

Notice, however, that calculations in REBOL are not limited to numbers. The various REBOL data types are known by their formats. In other words, 01-JAN-2000 is known to be a date by its form. REBOL will add to dates, times, currency, tuples, pairs. You have to make sure the two data types you are adding are the same or compatible. This makes it very easy to calculate dates or times in the past or future; just add to a date and REBOL takes care of everything.