| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- program expr;
- (* Program to test various types of expressions *)
- type string80 = STRING[80];
- var Flag : boolean;
- Ch1, Ch2 : char;
- I, J, K : integer;
- X, Y : real;
- Str1, Str2, Str3 : string80;
- Str4, Str5: string[80];
- begin
- (* Assign values correctly *)
- I := 10;
- J := 122;
- K := 55;
- X := 1.25;
- Y := 44.5;
- (* Assign values of different type *)
- I := 10.5;
- J := 122.78;
- K := 55.35;
- X := 1;
- Y := 44;
- (* String Assignment *)
- Str1 := 'Hello there ';
- Str2 := 'Sally';
- Ch1 := 'A';
- Ch2 := ^G;
- Str3 := Str1; (* valid because of same type *)
- Str4 := Str1; (* not valid because of different type *)
- Str5 := Str4; (* not valid because of different type *)
- (* Translator converts expression *)
- Y := Y + 100;
- writeln('Y = ',Y); writeln;
- (* Translator converts expression *)
- X := X + I;
- writeln('X = ',X); writeln;
- (* Expressions below will not be translated *)
- Str3 := 'Hello ' + 'There';
- Str3 := Ch1 + ' big hello';
- Str3 := Ch1 + Str1;
- Str3 := Str1 + Str2;
- (* Expression below will not be translated *)
- Flag := Str2 = 'Sally';
- END.
|