Am 18.10.2010 14:58, schrieb Frank Church:
>
>
> On 18 October 2010 07:49, Florian Klaempfl <[email protected]
> <mailto:[email protected]>> wrote:
>
> Am 18.10.2010 08:17, schrieb Zaher Dirkey:
> >
> >
> > On Thu, Oct 14, 2010 at 11:21 AM, Michael Van Canneyt
> > <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> >
> >
> > On Thu, 14 Oct 2010, Frank Church wrote:
> >
> > Can variables be declared within a begin end block?
> >
> >
> > No.
> >
>
>
> That is a rather emphatic no :).
> Is there some performance or other related reason why it is a bad idea?
It's just a matter of readability, e.g. having a variable declared in
two blocks with the same name can cause you a lot of headache:
procedure p;
begin
...
begin
var i : integer;
...
...
...
i:=12341234;
...
...
...
...
end;
...
...
...
begin
var i : integer;
...
writeln(i); <--- this i is not the same as above so i does not
contain 12341234 but it contains probably some garbage.
end;
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal