# Board index » delphi » Arrays of Procedures?

## Arrays of Procedures?

##### Quote
Dave Lowry (lo...@src.honeywell.com) wrote:
> Is it possible in any dialect of Pascal to declare an array of procedures?

Borland (Turbo) Pascal supports this.

GNU Pascal supports arrays of *pointers to* procedures which has the
same effect.  (We are working on implementing Borland's method into
GNU Pascal, too.)

Best wishes,

Peter

e-mail:  peter.gerwin...@uni-essen.de
home address:  D\"usseldorfer Str. 35, 45145 Essen, Germany
WWW:  http://agnes.dida.physik.uni-essen.de/~peter/

## Re:Arrays of Procedures?

Is it possible in any dialect of Pascal to declare an array of procedures?
Something like:

type
tproc = procedure(x: integer);

var
r: array[1..10] of tproc;

begin
r[0] = procedure1;
r[1] = procedure2;

r[0](123);
r[1](456)
end.

Thanks.

-Dave

## Re:Arrays of Procedures?

Hi there,

##### Quote
In article <5bdp8f\$...@terpsichore.htc.honeywell.com>, lo...@src.honeywell.com (Dave Lowry) writes:
> Is it possible in any dialect of Pascal to declare an array of procedures?
> Something like:

> type
> tproc = procedure(x: integer);

> var
> r: array[1..10] of tproc;

> begin
> r[0] = procedure1;
> r[1] = procedure2;

> r[0](123);
> r[1](456)
> end.

Yes ! Yes ! Yes !

I wrote something like this a few years ago in TP7.

I see you guessed the syntax, so just try it.

(Don't forget to write the bodies of procedure1 and procedure2 :-)   )

Bye.

Christophe.

## Re:Arrays of Procedures?

##### Quote
lo...@src.honeywell.com (Dave Lowry) wrote:
>Is it possible in any dialect of Pascal to declare an array of procedures?

Of course.

But you need to declare your procedure FAR!

procedure procedure2; FAR;
begin
end;

##### Quote
>Something like:

>type
>tproc = procedure(x: integer);

>var
>r: array[1..10] of tproc;

>begin
>r[0] = procedure1;
>r[1] = procedure2;

>r[0](123);
>r[1](456)
>end.

>Thanks.

>-Dave

--
AVONTURE Christophe                    0 0      The Crazy Programmer
Christophe.Avont...@is.belgacom.be      |         Brussels (Belgium)
Uses Standard_Disclaimer;              \_/            Happy New Year
French Pascal programmation site     http://www.mygale.org/07/jmy51/