Mark Reinhard wrote:

> This does look kind of strange at first but all that is happening is
> that the compiler sees a blank statement inside the begin..end block.
> Think of it this way:
> 
> 
>   if (assigned(loc)) then begin
>     ;  // this is OK. It just gets optimized out
>     // somecode
>   end;
> 
>  
> This will compile fine too:
> 
> 
>   if (assigned(loc)) then begin;;;;;;;;;;
>     ;;;;;;;;;;
>     // somecode
>   end;;;;;;;;;;

Exactly right, but in context appending extra semicolons after 
control structure statements is a common beginner's error with 
potentially problematic ramifications.

Consider:

     if (Condition1) then;
       DoSomething;
or
     while (Condition2) do;
       DoSomethingElse;

I've seen newbies banging their heads over why DoSomething is 
called no matter what Condition1 evaluates to or why 
DoSomethingElse is called only once, regardless of Condition2.

Stephen Posey
[EMAIL PROTECTED]

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to