*/
Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?
*/

View \CONSTANT.PAS

Getting Started with the Pascal tutorial, source

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 6 - Program 4 *)
program Example_Of_Constants;

const  Max_Size = 12; (* Pascal assumes this is a byte type, but it
                         can be used as an integer also *)

       Index_Start   : integer = 49; (* This is a typed constant *)
       Check_It_Out  : boolean = TRUE; (* Another typed constant *)

type Bigarray  = array[1..Max_Size] of integer;
     Chararray = array[1..Max_Size] of char;

var  Airplane   : Bigarray;
     Seaplane   : Bigarray;
     Helicopter : Bigarray;
     Cows       : Chararray;
     Horses     : Chararray;
     Index      : integer;

begin  (* main program *)
   for Index := 1 to Max_Size do begin
      Airplane[Index] := Index*2;
      Seaplane[Index] := Index*3 + 7;
      Helicopter[Max_Size - Index + 1] := Index + Airplane[Index];
      Horses[Index] := 'X';
      Cows[Index] := 'R';
   end;
end(* of main program *)

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.