From COBOL to OOP

3.2: Replacement for the Procedure Division: Instructions

3.2 Replacement for the Procedure Division: Instructions

There are no divisions in OOP

As mentioned, there is no counterpart of the COBOL's "division" in object-oriented programming. On the other hand, object-oriented programming divides programs into several parts (although the division is less strict). The instruction part discussed in this section corresponds roughly to the Procedure Division. In particular, this section introduces the most important instructions: value assignment, branch instructions, and loops.

3.2.1 Assigning Values

Although COBOL uses three different types to assign one value to another MOVE, COMPUTE, and SET object-oriented programming has only one assignment operator. It does not matter whether the new value is a constant or an expression yet to be computed.

Delphi

In Delphi, the assignment operator is :=.

Java

In Java, the assignment operator is =.

Basically, a value assignment of the type x := y means that the left side is evaluated first (naturally in this case, but it could well be a value that would have to be determined first, for example, the xth element of an array). The right side is evaluated next, and finally, the value of the left side is replaced by the value of the right side. A (composite) variable must be on the left, and both sides must be compatible in terms of assignment.

Compatibility in terms of assignment or type does not necessarily mean that both variables have to be of the same type. We also speak of type compatibility when the...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programming Languages
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.