Autor Beitrag
Luncustaf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Do 12.06.03 09:45 
hi,

ich hab hier diese if anweisung

ausblenden Delphi-Quelltext
1:
if not (DayOfWeek(a) = 7or (DayOfWeek(a) = 1then					


das komische wenn DayOfWeek 7 zurück liefert dann springt er nicht in die if anweisung wie angegeben gibt DayOfWeek wiederum den Wert 1 zurück springt er trotzdem in die if-anweisung :(

ich kann mir nicht erklären wieso eigentlich sollte es doch so funktionieren oder?


gr€€tz


Zuletzt bearbeitet von Luncustaf am Do 12.06.03 11:01, insgesamt 1-mal bearbeitet
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Do 12.06.03 09:57 
Hi,

wie denn auch, wenn du ein not davorsetzst.

Wenn du hin und wieder Kommas und Punkte in deine Sätze einbauen würdest, dann würde man beim ersten Lesen schon verstehen was Du willst.

MFG

- Ernesto -
Luncustaf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Do 12.06.03 10:18 
hi,


das mit dem not stimmt schon. er soll nur in die if-anweisung springen, wenn DayOfWeek alles ausser 7 oder 1 zurückgibt.


gr€€tz
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Do 12.06.03 10:32 
Hi,

ach so. Dann kannst Du es so machen:

ausblenden Delphi-Quelltext
1:
if not (DayOfWeek(a) = 7and not  (DayOfWeek(a) = 1then					


Du musst beide Bedingungen verneinen und mit and verknüpfen.

MFG

- Ernesto -
Tana´Ri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 230



BeitragVerfasst: Do 12.06.03 10:34 
@Luncustaf der post ist doch wohl net ernst gemeint oder ?

falls doch, dein not bezieht sich nur auf erste klammer

entwedern

if not ((DayOfWeek(a) = 7) or (DayOfWeek(a) = 1)) then

oder hab ich letzten erst gemerkt das es funzt, ist zwar umständlich aber net :wink:

if DayOfWeek(a) = 2 or 3 or 4 or 5 or 6 then

_________________
mfg
Tana´Ri
Luncustaf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Do 12.06.03 10:35 
hi,

wenn ich das aber so mache dann muss DayOfWeek doch gleichzeitig 1 und 7 zurückliefern, dass er nicht in die if-anweisung springt - aber ich werde die zweite anweisung mal verneinen :)

thx für deine hilfe.


gr€€tz
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Do 12.06.03 10:38 
Hi,

probier erst mal meinen Code aus. Der funktioniert. Dann lies Dir mal die Delphi-Hilfe nach booleschen Operatoren durch.

MFG

- Ernesto -

// Edit: Tana`Ri's Code funtioniert auch
Luncustaf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Do 12.06.03 11:01 
hi,

hmm hat geklappt wundert mich wieso :) naja ich geh mal hilfe lesen. thx vielmals für deine hilfe.

gr€€tz
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Do 12.06.03 11:07 
gerngeschehen :wink:
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 12.06.03 11:08 
Dein Code entspricht folgendem Vorgehen:
ausblenden Delphi-Quelltext
1:
if (not (DayOfWeek(a) = 7)) or (DayOfWeek(a) = 1then					


Sprich "wenn DayOfWeek<>7 oder DayOfWeek=1 dann mach weiter".. um das zu erreichen was du willst gibts 2 Möglichkeiten:

1)if not ((DayOfWeek(a) = 7or (DayOfWeek(a) = 1) )then
2)if not (DayOfWeek(a) = 7and not (DayOfWeek(a) = 1then

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Wolff68
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 302
Erhaltene Danke: 1

WinXP home
D6 Prof
BeitragVerfasst: Do 12.06.03 21:47 
Also um zu prüfen, ob eine Variable in einem bestimmten Bereich liegt kann man auch sehr elegant den IN-Operator verwenden.
ausblenden Delphi-Quelltext
1:
2:
3:
  IF DayOfWeek(a) in [2..6then begin
    ShowMessage('Ausführung');
  end;

Kurz, knapp, einleuchtend und schnell. :idea:

_________________
"Der Mensch ist nicht was er sich vorstellt oder wünscht zu sein, sondern das was andere in ihm sehen."