10-14-2022, 04:33 AM
IF h = ASC(g.flagship) OR h = g.m_asc THEN
IF h = ASC(g.flagship) THEN
ii = 1
EXIT FOR
ELSE
ii = 2
EXIT FOR
END IF
END IF
The above here, just seems dang weird to me.
IF h = 1 OR h = 2 THEN <-- This says only of h is 1 or 2 then we do inside this block
IF h = 1 THEN
do_whatever <-- so h is 1 here and we do something
ELSE
do_junk <-- h *has* to be 2 here to do junk. (Otherwise we wouldn't have passed the first IF)
END IF
END IF
Now my question is: WTH is the point of that outer loop to even begin with???
IF h = 1 THEN do_whatever
IF h = 2 THEN do_junk
PRESTO! Done, clean, with several fewer IF checks and SCREEN calls...
What am I missing here? Why do you IF check for 2 conditions and then IF check for each of those conditions independently?
Personally, I'd just SELECT CASE the code and keep it simple.
SELECT CASE SCREEN(j, k + i)
CASE IS = ASC(g.flagship): ii =1: EXIT FOR
CASE IS = g.m_asc: ii = 2: EXIT FOR
END SELECT
IF h = ASC(g.flagship) THEN
ii = 1
EXIT FOR
ELSE
ii = 2
EXIT FOR
END IF
END IF
The above here, just seems dang weird to me.
IF h = 1 OR h = 2 THEN <-- This says only of h is 1 or 2 then we do inside this block
IF h = 1 THEN
do_whatever <-- so h is 1 here and we do something
ELSE
do_junk <-- h *has* to be 2 here to do junk. (Otherwise we wouldn't have passed the first IF)
END IF
END IF
Now my question is: WTH is the point of that outer loop to even begin with???
IF h = 1 THEN do_whatever
IF h = 2 THEN do_junk
PRESTO! Done, clean, with several fewer IF checks and SCREEN calls...
What am I missing here? Why do you IF check for 2 conditions and then IF check for each of those conditions independently?
Personally, I'd just SELECT CASE the code and keep it simple.
SELECT CASE SCREEN(j, k + i)
CASE IS = ASC(g.flagship): ii =1: EXIT FOR
CASE IS = g.m_asc: ii = 2: EXIT FOR
END SELECT