mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 12:31:38 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			361 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			361 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| Program Example45;
 | |
| 
 | |
| { Program to demonstrate the Ord,Pred,Succ functions. }
 | |
| 
 | |
| Type
 | |
|   TEnum = (Zero, One, Two, Three, Four);
 | |
|   
 | |
| Var 
 | |
|   X : Longint;
 | |
|   Y : TEnum;
 | |
|   
 | |
| begin
 | |
|   X:=125;
 | |
|   Writeln (Ord(X));  { Prints 125 }
 | |
|   X:=Pred(X);
 | |
|   Writeln (Ord(X));  { prints 124 }
 | |
|   Y:= One;
 | |
|   Writeln (Ord(y));  { Prints 1 }
 | |
|   Y:=Succ(Y);
 | |
|   Writeln (Ord(Y));  { Prints 2}
 | |
| end.
 | 
