Autor Beitrag
Brina* Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Fr 05.09.08 18:34 
Das IntToStr mit einem "t" war nur ein Tippfehler, sorry!
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 05.09.08 18:49 
user profile iconMarc. hat folgendes geschrieben:
user profile iconBenBE hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
    label1.caption:= InToStr(a)+tmp+IntToStr(b)+'=';					

Ich denk, du meintest:

ausblenden Delphi-Quelltext
1:
2:
...
  label1.caption:= InToStr(a)+tmp+IntToStr(b)+'=';


Stimmt's???

Nö!
Ich denk, du meintest:
ausblenden Delphi-Quelltext
1:
label1.caption:= IntToStr(a)+c+IntToStr(b)+'=';					

Hab mich in meinem Beispiel hauptsächlich auf den Case\End-Fehler bezogen. Dn Schreibfehler hab ich übersehen ...

user profile iconTilman hat folgendes geschrieben:
Und wenn man mit den begins und ends durcheinanderkommt ist es guter Stil diese mit Kommentaren zu versehen, als fortgeschrittener sowieso, aber als Anfänger auch sehr zu empfehlen:


Dann sollte man das aber korrekt tun ;-)
user profile iconTilman hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure irgendwas;
begin
  if bla then
  begin
    case tmp of
      0: machwas;
      1: machwasandres;
      else
        sonstwas;
    end// case tmp
  end// if bla
end// procedure irgendwas


Case else hat nur ein End, wenn man explizit mit else begin einen Block anfängt. Dann gehört dieses End aber nicht zum Case else, sondern zum expliziten begin dieses Blockes ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 05.09.08 18:56 
user profile iconBenBE hat folgendes geschrieben:
Case else hat nur ein End, wenn man explizit mit else begin einen Block anfängt. Dann gehört dieses End aber nicht zum Case else, sondern zum expliziten begin dieses Blockes ;-)


Nein. Case endet immer mit einem end.

Delphi-Hilfe hat folgendes geschrieben:
Die Syntax einer case-Anweisung lautet

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
case SelektorAusdruck of
  caseList1: Anweisung1;
  ...
  caseListn: Anweisungn;
end

_________________
We are, we were and will not be.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 05.09.08 19:05 
user profile iconGausi hat folgendes geschrieben:
user profile iconBenBE hat folgendes geschrieben:
Case else hat nur ein End, wenn man explizit mit else begin einen Block anfängt. Dann gehört dieses End aber nicht zum Case else, sondern zum expliziten begin dieses Blockes ;-)


Nein. Case endet immer mit einem end.

Delphi-Hilfe hat folgendes geschrieben:
Die Syntax einer case-Anweisung lautet

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
case SelektorAusdruck of
  caseList1: Anweisung1;
  ...
  caseListn: Anweisungn;
end

Das ist klar. Es ging aber um das von Tilman in Zeile 10 in seinem Quelltext überflüssig eingefügte end// else.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Fr 05.09.08 19:14 
Oh ja stimmt hast recht :-) hatte vorher sogar noch ein überflüssiges begin drinne, werde das end natürlich auch noch rausnehmen :roll: (irgendwie kam mir der code eh komisch vor ^^) weiß auch net was das heute ist ^^

P.S. da seht's ihr mal wie wichtig das kommentieren ist!!! *gg

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 05.09.08 20:28 
user profile iconTilman hat folgendes geschrieben:
P.S. da seht's ihr mal wie wichtig das kommentieren ist!!! *gg

GANZ WICHTIG!!! :mrgreen:

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.