next up previous contents
Next: Variables and Constants Up: Declarations Previous: Declarations

Variable and Constant Declarations

 

In ISO Pascal there are five kinds of constants. There are integer constants, real constants, character constants, boolean constants and string constants. Variables can be declared to be of one of the primitive types integer, real, char or boolean, or they can be of a type declared in a type declaration, like an array or a record. For the variables we will only focus on the primitive types for now.

The primitive Pascal types integer, real, char and boolean, correspond to respectively types int, float, char and boolean in Java, as you might have expected. A string constant in Pascal should be of type java.lang.String in Java.

At first I thought that compiling the Pascal variables and constants the same way as variables and constants in Java are compiled was the way to do it. A little later it turned out that that was not completely right. The next subsections will tell you why.





mark@bottom.xs4all.nl