For example, compare the equivalent blocks of code from C and COBOL to calculate weekly earnings: // Calculation in C: if (salaried) amount = 40 * payrate; else amount = hours * payrate; *> Calculation in COBOL: IF Salaried THEN MULTIPLY Payrate BY 40 GIVING Amount ELSE MULTIPLY Payrate BY Hours GIVING Amount END-IF. *> Other example of calculation in COBOL: IF Salaried COMPUTE Amount = Payrate * 40 ELSE COMPUTE Amount = hours * payrate END-IF.
На пример, упоређујући еквивалентне блокове кода из С и COBOL за израчунавање недељних зарада: // Calculation in C: if (salaried) amount = 40 * payrate; else amount = hours * payrate; *> Calculation in COBOL: IF Salaried THEN MULTIPLY Payrate BY 40 GIVING Amount ELSE MULTIPLY Payrate BY Hours GIVING Amount END-IF. *> Other example of calculation in COBOL: IF Salaried COMPUTE Amount = Payrate * 40 ELSE COMPUTE Amount = hours * payrate END-IF.