Autor Beitrag
nepleurepas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: So 21.09.08 12:53 
Hallo,

gibt es eine möglichkeit, eine bedingung zu invertieren ohne 'else' zu verwenden?
Bsp:
ausblenden Delphi-Quelltext
1:
2:
if (a=250and (b=250then .....// tritt ein, wenn sowohl a als auch b den wert 250 haben[1]
                       else .... // tritt ein, wenn obiges nicht erfüllt ist              [2]


wie kann ich nun [2] als folge von 'then' erhalten, wenn (a=250) and (b=250) immernoch in der bedingung stehen sollen? Ich muss also das (a=250) and (b=250) irgendwie invertieren. Mathematisch 1-((a=250) and (b=250)).
Und jetzt sagt mir bitte nicht if (a<>250) or (b<>250), das is mir schon klar. Ich wills halt mit der Delphi syntax invertieren...

Hoffe ihr versteht mich
Danke
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: So 21.09.08 12:57 
De Morgan'sche Gesetze ;-)

ausblenden Delphi-Quelltext
1:
not (a=250and (b=250) ==> (not (a=250)) or (not (b = 250)) ==> (a <> 250or (b <> 250)					

_________________
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.


Zuletzt bearbeitet von BenBE am So 21.09.08 13:11, insgesamt 1-mal bearbeitet
nepleurepas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: So 21.09.08 13:07 
(a=250and (b=250) ==> (not (a=250)) or (not (b = 250)) ==> (a <> 250or (b <> 250)[/quote]
ja gut, dass war jetz mathematisch verneint. Meine frage war ja, ob es n operator gibt. "Else" sagt ja im prinzip nichts anderes als 'alle Fälle, die nicht unter 'if' fallen.
Meine frage jetzt, kann ich auch direkt sowas wie 'else' in die bedingung schreiben?
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: So 21.09.08 13:10 
ausblenden Delphi-Quelltext
1:
if not (Bedingung) Then					


Macht auch nix andres, als ich jetzt grad Mathematisch gezeigt hab. Sollte man aber immer schauen, ob es nicht sinnvoller ist, die Bedingung mal eben mathematisch negiert.

_________________
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.
nepleurepas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: So 21.09.08 13:11 
user profile iconBenBE hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
if not (Bedingung) Then					


Macht auch nix andres, als ich jetzt grad Mathematisch gezeigt hab. Sollte man aber immer schauen, ob es nicht sinnvoller ist, die Bedingung mal eben mathematisch negiert.


okay, danke