Question: I have seen this code posted here on StackOverflow:

```
with TDownloadURL.Create(nil) do
  try
    URL := 'myurltodownload.com';
    filename := 'locationtosaveto';
    try
      ExecuteTarget(nil);
    except
      result := false;
    end;
    if not FileExists(filename) then
      result := false;
  finally
    free;
  end;

```

Can't it be simplified to look like:

```
 Result:= FALSE;               <--------- Compiler complains
 DeleteFile(Dest);
 dl:= TDownloadURL.Create(NIL);
 TRY
   dl.URL:= URL;
   dl.FileName:= Dest;
   dl.ExecuteTarget(NIL);           
   Result:= FileExists(Dest);
 FINALLY
   dl.Free;
 END;

```

The final Result:= ... will never be executed if something went wrong in 'ExecuteTarget' because the program will jump directly to 'finally'. Right? So, the function will return FALSE. Am I doing something wrong?

---

PS:

1. I intend to use this code in a thread.
2. I just put the function in Delphi and the compiler complains about the first line: "Value assigned never used."

Answer: 
In the original, if ExecuteTarget throws an exception, it will still test of filename exists. 

In yours, if ExecuteTarget throws an exception, result is always false.

Also, unless you skipped a line, on the original, if ExecuteTarget succeeds and the file exists, `result` is never set.
The first version just eat the exception and never raise to upper callers, it treat exception as false return. For your simple version, exception will be thrown out.