Hi,
I have no good reason for asking this except for clearing up confusion. I'm a little fuzzy with the logic of this.
If:
Code:(1)
IF A THEN IF B THEN PRINT 1 ELSE PRINT 2
is the same as:
Code:(2)
IF A THEN
IF B THEN
PRINT 1
ELSE
PRINT 2
ENDIF
ENDIF
or perhaps:
Code:(3)
IF A THEN
IF B THEN
PRINT 1
ENDIF
ELSE
PRINT 2
ENDIF
Why isn't:
Code:(4)
IF A THEN IF B THEN PRINT 1 ELSE PRINT 2 ELSE PRINT 3
the same as:
Code:(5)
IF A THEN
IF B THEN
PRINT 1
ELSE
PRINT 2
ENDIF
ELSE
PRINT 3
ENDIF
??
It's the route through the logic that is confusing me. I think I understand how each works, with the exception of (4). This seems to follow the same comparable logic as the others but doesn't give the same result - i.e. the action after the last ELSE is ignored. My logic (dubious, at best) suggests that the last ELSE is applied only if A is NOT TRUE. Yet it is the fist ELSE that is actioned when either A is NOT TRUE or B is NOT TRUE.
Matt