REBOL for COBOL programmers

Go to table of contents Go to feedback page

DIVIDE with REMAINDER

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

This page explains some REBOL equivalents of DIVIDE with REMAINDER.


COBOL DIVIDE with REMAINDER

DIVIDE has syntax allowing you to get the remainder.

DIVIDE { identifier-1 } INTO { identifier-2 } GIVING identifier-3 [ROUNDED] REMAINDER identifier-4.
       { literal-1    }      { literal-2    }
DIVIDE { identifier-1 } BY { identifier-2 } GIVING identifier-3 [ROUNDED] REMAINDER identifier-4.
       { literal-1    }    { literal-2    }

The REBOL equivalent

REBOL has a separate function for the reaminder.

identifier-3: remainder identifier-1 identifier-2  
This divides the first item (identifier-1) BY the second (identifier-2) and returns the remainder, which in this case would be put into identifier-3.