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
>>However it shows again the image problem of pascal, cause by
people making assumptions on old compilers during their student
years, and keep comparing it to later ones forever.
>>If even reasonably intelligent people can't escape from it, maybe
we are doomed.
-- Maybe a new book need
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:
14 matches
Mail list logo