Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> var variable declaration pp 49</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 VAR                         Variable Declaration                      pp 49


 Define:  VAR is the reserved word for variable declaration.

 Purpose: Declare both local and global variables.

 Notes:   Every variable must be declared prior to use or reference.
          Several standard type identifiers are provided, and the
          programmer may create his own type using the Type definition.


 ----------------------------------------------------------------------------


 Usage:
       TYPE
          PtrType   = ^Integer   ;  { Type is pointer to Integer data }
          SetType   = 0..7       ;  { Type is Set of 0 to 7 members   }
          DayType   = (Mon,Tue,Wed,Thu,Fri,Sat,Sun);
          StrType   = String [80];  { Type is 80 byte string          }


       VAR
          CharVar   : Char       ;
          ByteVar   : Byte       ;
          IntVar    : Integer    ;
          RealVar   : Real       ;
          StrVar1   : String [80];  { Type is 80 byte string          }
          StrVar2   : StrType    ;  { Type is user declared StrType   }
          PtrVar    : PtrType    ;  { Type is user declared PtrType   }
          DayVar    : DayType    ;  { Type is user declared DayType   }
          SetVar    : SetType    ;  { Type is user declared SetType   }

       BEGIN
       END.

See Also: Const Function Label Procedure Type

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson