REBOL for COBOL programmers

Go to table of contents Go to feedback page

COMPUTE

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

This page explains some REBOL equivalents of COMPUTE.


COBOL COMPUTE

The COMPUTE statement allows for more involved calculations.

COMPUTE identifier-1 = arethmetic-expression-1.             
For example,
COMPUTE d = ((b ** 2) - ( 4 * a * c)) / (2 * a)

The REBOL equivalent

REBOL is very similar in this area. There is no official equivalent function for COMPUTE, but you can just put an expresseion where needed. For example:

print d: ((b ** 2) - ( 4 * a * c)) / (2 * a)
This will set "d" to the indicated value, and then print it, all in one statement.