*/
Know a good article or link that we're missing? Submit it!
*/

View \ALLVAR.PAS

Getting Started with the Pascal tutorial, source

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


(* Chapter 3 - Program 3 *)
program All_Simple_Variable_Types;

var  A,B         : integer;
     C,D         : byte;
     Dog_Tail    : real;
     Puppy       : boolean;
     Animal_Cookies : char;

begin
   A := 4;
   B := 5;
   C := 212;
   D := C + 3;
   Dog_Tail := 345.12456;
   Puppy := B > A;  (* since B is greater than A, Puppy
                       will be assigned the value TRUE *)

   Animal_Cookies := 'R'(* this is a single character *)

   Writeln('The integers are',A:5,B:5);
   Writeln('The bytes are',   C:5,D:5); (* notice that the spaces
                                           prior to the C will be
                                           ignored on output *)

   Writeln('The real value is',Dog_Tail:12:2,Dog_Tail:12:4);
   Writeln;
   Writeln('The boolean value is ',Puppy,Puppy:13);
   Writeln('The char variable is an ',Animal_Cookies);
end.

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.