- IF A and B THEN " tests A; if A is false, B is never tested and THEN is not executed; THEN will execute whenever (and only whenever) both A and B are true.
- "IF (A AND B) THEN" first bitwise-ANDs A with B, then tests that result versus zero; if non-zero, THEN is executed. Meaning, both A and B could be TRUE, but THEN won't necessarily execute
Announcement
Collapse
No announcement yet.
Question About Bitwise Expression in If
Collapse
X
-
Because that's how "short circuit" evaluation works in the compiler.
-
Question About Bitwise Expression in If
In following code control should not got to ReplaceMonthName SUB but only first "If" works correctly. Can anyone explain why this is so?
Code:%UsesMonthNames = 1 %DelimiterSlash = 2 %DelimiterDot = 4 %DelimiterDash = 8 %YearFirst = 16 %YearMiddle = 32 %YearLast = 64 %MonthFirst = 128 %MonthMiddle = 256 %MonthLast = 512 %DayFirst = 1024 %DayMiddle = 2048 %DayLast = 4096 %Y2 = 8192 %Y4 = 16384 DateFormat = 20752 If (DateFormat And %UsesMonthNames) Then ReplaceMonthName D$ End If If DateFormat And %UsesMonthNames Then ReplaceMonthName D$ End If
Tags: None
Leave a comment: