REBOL for COBOL programmers |
COMPUTE
Date written: March 19, 2013 This page explains some REBOL equivalents of COMPUTE. COBOL COMPUTEThe 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 equivalentREBOL 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. |