Re: Why is Connect() located before "try" instead of in it?

Giganews Newsgroups
Subject: Re: Why is Connect() located before "try" instead of in it?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 7 Jul 2006

"Vincent Delporte" <justa…@acme.com> wrote in message
news:2fura2tcd4nfeth2cgc4e2rcr7l4p5gg…@4ax.com...

> why Connect is located _before_ the "try" section instead
> of _in_ it?

No particular reason.  Probably just the personal preference of whoever
wrote the examples.

> I would expect the tentative instructions to all be located
> between the try and except statements

They usually are, ie:

    IdTCPClient1.Host := 'localhost';
    IdTCPClient1.Port := 80;
    try
        IdTCPClient1.Connect;
        try
            ShowMessage('try');
        finally
            IdTCPClient1.Disconnect;
        end;
    except
        ShowMessage('except');
    end;

> Did Delphi 2006 introduce the try/except/finally structure?

No.  That has been available in Delphi for a long time.

Gambit

Replies

In response to

Why is Connect() located before "try" instead of in it? posted by Vincent Delporte on Fri, 07 Jul 2006