REBOL for COBOL programmers

Go to table of contents Go to feedback page

DIVIDE

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

This page explains some REBOL equivalents of DIVIDE.


COBOL DIVIDE

DIVIDE has a syntax just like you might say it, including but not limited to:

DIVIDE { identifier-1 } INTO identifier-2 [ROUNDED].
       { literal-1    }
DIVIDE { identifier-1 } INTO { identifier-2 } GIVING identifier-3.
       { literal-1    }      { literal-2    }
DIVIDE { identifier-1 } BY { identifier-2 } GIVING identifier-3 [ROUNDED].
       { literal-1    }    { literal-2    }
There are other options for remainders and size errors, as you probably know.

The REBOL equivalent

REBOL has a "divide" function. It also has the "/" function which is the same, and a separate "remainder" function for getting at the remainder.

identifier-2: divide identifier-1 identifier-2
identifier-3: divide identifier-1 identifier-2