Greetings:
Running the code below we can see that the Finally works correctly
with the exit statement:
Program Test;
{$mode objfpc}{$H+}
Procedure x(i :Integer);
Begin
Try
Begin
WriteLn('Running Try');
if (i=2) then exit;
WriteLn('After if(i=2)');
End;
Finally
Wr
On Sunday 20 April 2008 19:21, Andreas Berger wrote:
> About break. I would like to see an implementation of Break(x) where
> x is the number of loops to break out of.
> Correction: I would not like this, I would LOVE it.
Oh, another Adaism trying to creep into Pascal...? :D
But let me revisit y
I am not like break(x) it also make improvement my procedure was
sensitive, i must count how many loop i have in, and i must care if i
added a new loop around the code that looped (hmm bad english).
On Sun, Apr 20, 2008 at 7:21 PM, Andreas Berger
<[EMAIL PROTECTED]> wrote:
>
>
> >
> > C provides
C provides the infinitely-abusable goto statement, and labels to
branch to. Formally the goto is never necessary and in practice it is
almost always easy to write code without it. We have not used goto in
this book.
Nonetheless , we will suggest a few situations where goto's may find a
pla
mm wrote:
Zaher Dirkey a écrit :
I hate exit when i try to improve a procedure
some code
if (b) then
exit;
some code
for long procedures i cant notice exit here and add some resource or
memory uses
AnObject := TAnObject.Create;
try
some code
if (b) then
exit;
some code
finally
Lets hear what the old fathers told us...
when Linus Torvalds was still running around the Christmas tree
Niklaus Wirth,
Algorithms and Data Structures 1985 (Oberon version: August 2004, afaik
first published 1975 in German)
(Regarding pointers and goto statements..)
...This phenomenon
Zaher Dirkey a écrit :
I hate exit when i try to improve a procedure
some code
if (b) then
exit;
some code
for long procedures i cant notice exit here and add some resource or memory uses
AnObject := TAnObject.Create;
try
some code
if (b) then
exit;
some code
finally
AnObject.Fre
I hate exit when i try to improve a procedure
some code
if (b) then
exit;
some code
for long procedures i cant notice exit here and add some resource or memory uses
AnObject := TAnObject.Create;
try
some code
if (b) then
exit;
some code
finally
AnObject.Free;
end;
Now Exit leave t
Hi!
GCC and almost all the other C implementations have the goto
statement. It is just ugly and dangerous use it many times in a
program. But IMHO any compiled language should have goto
because many times we need to do unstructured code to run
fast (in complex search code for example). So go
Vinzent Hoefler a écrit :
On Thursday 17 April 2008 17:53, mm wrote:
Rodrigo Palhano a écrit :
On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]>
wrote:
I use GO TO when teaching pascal, but after all i ask them to not
use it, it
just a bridge to learning the logic of progra
for a := 0 to x do
for b := 0 to y do
for c := 0 to z do
if (...) then
begin
// Do something and then exit all loops
exit; // Or maybe: goto OutSideOfLoops;
end;
In Pascal I can't change the 'a' and 'b' values to force the end of
the loop. So what other GOOD
On 17 Apr 2008, at 21:25, Andreas Berger wrote:
for a := 0 to x do
for b := 0 to y do
for c := 0 to z do
if (...) then
begin
// Do something and then exit all loops
exit; // Or maybe: goto OutSideOfLoops;
end;
In Pascal I can't change the 'a' and 'b' values t
C does have goto.
cheers
Wayne
On Thu, Apr 17, 2008 at 12:57 PM, Marco Alvarado <[EMAIL PROTECTED]> wrote:
> The problem of GOTO is that C doesn't have one. If C had one, and
> Pascal didn't have a GOTO, they would blame Pascal for not having it.
> In assembler GOTOs make a lot of sense (i.e. J
The problem of GOTO is that C doesn't have one. If C had one, and
Pascal didn't have a GOTO, they would blame Pascal for not having it.
In assembler GOTOs make a lot of sense (i.e. JMP and Jxx), and it's
weird C doesn't have one, after all C tries to be the lowest level of
the highest level languag
I think "exit" and "goto" have their uses. Here is an example:
for a := 0 to x do
for b := 0 to y do
for c := 0 to z do
if (...) then
begin
// Do something and then exit all loops
exit; // Or maybe: goto OutSideOfLoops;
end;
In Pascal I can't change the
Rodrigo Palhano wrote:
this
if ( payments per year <> 12 ) then begin
Result := 1;
exit;
end;
if ( rate = 0 ) then begin
Result := 2;
exit;
end;
is better than this ?
if ( payments per year <> 12 ) then begin
Result := 1
Else if ( rate = 0 ) then
Result := 2;
or even this ?
In my
this
if ( payments per year <> 12 ) then begin
Result := 1;
exit;
end;
if ( rate = 0 ) then begin
Result := 2;
exit;
end;
is better than this ?
if ( payments per year <> 12 ) then begin
Result := 1
Else if ( rate = 0 ) then
Result := 2;
or even this ?
begin
If not CheckPayments (Re
if X = 0 then Exit;
at the beginning of the procedure, one writes
if X <> 0 then
begin
When you use it at the begining it may be arguably ok. But when it is used
in the
middle of procedure code it may be hard to notice.
On Thu, 17 Apr 2008 13:07:45 -0300, ik <[EMAIL PROTECTED]> wro
On Thursday 17 April 2008 17:53, mm wrote:
> Rodrigo Palhano a écrit :
> > On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]>
wrote:
> >> I use GO TO when teaching pascal, but after all i ask them to not
> >> use it, it
> >> just a bridge to learning the logic of programming lang
mm wrote:
Using "Exit" is not of a bad programming practice. Suppose one has to
write a big procedure, say 150 lines of code. Suppose now that, instead
of writing
if X = 0 then Exit;
at the beginning of the procedure, one writes
if X <> 0 then
begin
...
Does a reader immediately see
On Thu, Apr 17, 2008 at 6:53 PM, mm <[EMAIL PROTECTED]> wrote:
> Rodrigo Palhano a écrit :
>
>
> > On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]>
> wrote:
> >
> >
> > > I use GO TO when teaching pascal, but after all i ask them to not use
> it, it
> > > just a bridge to learni
Rodrigo Palhano a écrit :
On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]> wrote:
I use GO TO when teaching pascal, but after all i ask them to not use
it, it
just a bridge to learning the logic of programming language.
There is another word i hate to use it it is EXIT.
On Tue, 15 Apr 2008 19:39:37 -0300, Zaher Dirkey <[EMAIL PROTECTED]> wrote:
I use GO TO when teaching pascal, but after all i ask them to not use
it, it
just a bridge to learning the logic of programming language.
There is another word i hate to use it it is EXIT.
I also understand EXIT as
I use GO TO when teaching pascal, but after all i ask them to not use it, it
just a bridge to learning the logic of programming language.
There is another word i hate to use it it is EXIT.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http:
The original text about this matter.
Go To Statement Considered Harmful
Edsger W. Dijkstra
http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html
On Tue, 15 Apr 2008 08:50:43 -0300, Florian Klaempfl
<[EMAIL PROTECTED]> wrote:
Vinzent Höfler schrieb:
Marco
Vinzent Höfler schrieb:
Marco van de Voort wrote:
Ahthe old goto arguinghow many beers have gone with it!
Linus is just right, since everyday the purists of the OO languages
still can't live without writing a GOTO; they just call it in another
"politically correct" way:
raise Exce
> Marco van de Voort wrote:
> >> Ahthe old goto arguinghow many beers have gone with it!
> >> Linus is just right, since everyday the purists of the OO languages
> >> still can't live without writing a GOTO; they just call it in another
> >> "politically correct" way:
> >>
> >> raise Ex
Marco van de Voort wrote:
Ahthe old goto arguinghow many beers have gone with it!
Linus is just right, since everyday the purists of the OO languages
still can't live without writing a GOTO; they just call it in another
"politically correct" way:
raise Exception.Create("TA-DA!")
Op dinsdag 15-04-2008 om 10:21 uur [tijdzone +0200], schreef Marco van
de Voort:
> > Linus also put (traditional) before pascal, just to make this clear.
> So
> > I don't see this as a 'rant on pascal', but just arguing with some
> > examples of older languages that goto's could be good in some ca
> Op dinsdag 15-04-2008 om 10:18 uur [tijdzone +0300], schreef ik:
> > I have read in the Linux Kernel malling list some emails, and I found
> > some points made by Linus Torvalds about Pasca;
> >
> > http://idkn.wordpress.com/2008/04/15/the-reason-why-linus-torvalds-hate-pascal/
> >
>
> Your st
> Ahthe old goto arguinghow many beers have gone with it!
> Linus is just right, since everyday the purists of the OO languages
> still can't live without writing a GOTO; they just call it in another
> "politically correct" way:
>
> raise Exception.Create("TA-DA!")
There is a fundamen
Ahthe old goto arguinghow many beers have gone with it!
Linus is just right, since everyday the purists of the OO languages
still can't live without writing a GOTO; they just call it in another
"politically correct" way:
raise Exception.Create("TA-DA!")
R#
2008/4/15, Joost van der S
Op dinsdag 15-04-2008 om 10:18 uur [tijdzone +0300], schreef ik:
> Hi,
>
> I have read in the Linux Kernel malling list some emails, and I found
> some points made by Linus Torvalds about Pasca;
>
> http://idkn.wordpress.com/2008/04/15/the-reason-why-linus-torvalds-hate-pascal/
>
Your statement
Who is Linus Torvalds?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
34 matches
Mail list logo