mardi 24 octobre 2017

Delphi 2006 proper use of END

Look at this code:

if Poruka(BM_UWARN, GetMsg('Da li zaista želite da odbijete nalog?')) = mrOk then
  begin
    tmps := TRN.ss;
    TrnPom.ss := TRN.ss;
    RadnikOdbio.l := AdresniSlog.Rabotnik;
    if Zakljucaj(1011, tmps, 3) then
      begin
        FRazlogOdbNal.ShowModal;
        case FRazlogOdbNal.ModalResult of
          mrOk:              
            BeBankComment.ss := FRazlogOdbNal.beRazlogOdbijanja.ss;              
          else
            Otkljucaj(1011, tmps, 3);
            exit;
        end;
      end;
   end;

It is not important what this code does, what I need help with is did I use enough ENDs in this part of code. So the first END is of CASE statement. Second END closes BEGIN of if Zakljucaj(1011,tmps,3) and the last END is closing BEGIN of starting IF. Is this the right way to close them, does compiler now which end refers to which part of the code? And also, does compiler knows that the else part refers to case statement? If not, is there a way to explicitly do this?

Aucun commentaire:

Enregistrer un commentaire