OpenBCM V1.07b12 (Linux)

Packet Radio Mailbox

DB0FHN

[JN59NK Nuernberg]

 Login: GUEST





  
ON4CGA > PASCAL   06.01.98 03:25l 112 Lines 3436 Bytes #999 (999) @ WW
BID : 3846-F1FBB
Read: DH7RW DG0OKW DG1NSE DF9NE GUEST
Subj: PASCAL BASICS (1)
Path: DB0MAK<DB0PV<DB0AAB<DB0ZKA<DB0LX<DB0CZ<DB0GE<LX0PAC<ON7RC<ON4ABG<
      ON4OB<ON4KTK<ON1KPU<F1HPZ<F1JUW
Sent: 980105/2126Z @:F1JUW.FNPP.FRA.EU #:30848 [Mericourt] FBB7.00 $:3846-F1FBB
From: ON4CGA@F1JUW.FNPP.FRA.EU
To  : PASCAL@WW

Date/time   : 5-jan-1998
Title       : PASCAL BASICS (1)
Original title: LES BASES DU PASCAL (1)
From: F1FBB@F1JUW.FNPP.FRA.EU

73 to all.

I will try to explain the basics of the PASCAL language to those who want,
so they can start programming some utilities - which are often found and used
on a packet radio station.
I don't have the pretention to call myself a pedagogue. I only hope to be as
clear as possible, and I'll try to keep it simple.
After sending two bulletins, I'll wait for a while to poll the interest there
might exist for PASCAL, before continuing this series.

PASCAL SEEN BY TURBO PASCAL.

-1- ELEMENTS OF THE LANGUAGE.

Each program starts with the declaration part.

 - Declaration of the program name with the RESERVED WORD "PROGRAM".
   example : Program TEST;

 - Declaration of units with the RESERVED WORD "USES".
   example : USES CRT,DOS;
   The UNITs are parts of programs or precompiled library routines,
   which are used by the program. The different UNITs are separated by a
   comma (,) and are terminated bij a semicolon (;).

 - Declaration of constants with the RESERVED WORD "CONST".
   example : CONST
                A = 'Good Morning';
                B : WORD = 23; {it is preferable, but not obligatory to
                                specify the type. The value 23 kan be
                                a type entirely signed (INTEGER), entirely
                                not signed (WORD) or an octet(BYTE)}
   When no constant is used in the program, this part of the declaration is
   useless. Constants are written one after the other separated by a
   semicolon ";". Generally to get the reading of a program the most clearly,
   only one constant per line is written.

 - Declaration of a TYPE variable with the RESERVED WORD "TYPE".
   example : TYPE T = ARRAY [1..255] OF CHAR;

   TYPEs can either be predefined or those defined by the programmer.
   The types are defined one after the other separated by a semicolon.
   The type identifiers begin obligatory by a letter (a..z or A..Z).
   The maximum namelength the compiler can handle is 63 characters.
   Between the identifier and the type-definition, we place the equal sign"=".

 - Declaration of variables with the RESERVED WORD "VAR".
   example :
   VAR
      X,Y : INTEGER;
      E : REAL;

Each line or source instruction is terminated by a semicolon.
The remarks are written in between the sign "{" or "(*" at start and
"}" or "*)" at the end.
Think about writing as much commentary as possible so you - or others -
won't have any difficulties with re-reading the source, even if that happens
years after the program was written.

After the declaration part we have the CODE.

The CODE always starts with the RESERVED WORD "BEGIN" and is terminated
with the word "END.".
(watch out for the 'dot' after the word "END.".)

example:

PROGRAM example;

CONST
   PI = 22/7;
   my_wish = 'Good Morning';
TYPE
   my_type = STRING[20];

VAR
   A : STRING;
   B : INTEGER;
   C : WORD;
   D : my_type;

BEGIN
   A:=D+' dear OM';
   WRITELN(D);
   WRITELN(A);
   C:=18+3;
   WRITELN(C);
END.


End of PART 1
Translated by and reactions to: on4cga@on4ktk.wvl.bel.eu

The author: F1FBB
AX25      : F1FBB @ F1JUW.FNPP.FRA.EU
Tel       : (Frankrijk) 03.21.49.85.33

QTH       : Fouquieres Les Lens.
Dpt       : 62 Pas de Calais.
Locator   : JO10LK.
First name: Raymond.



Read previous mail | Read next mail


 18.05.2024 20:18:42lGo back Go up