Hi,
Just like for Shawn, my experience is that Select Case is "cleaner" code but takes more space than a bunch of IF/THEN. There's one difference to keep in mind though - which may or may not matter:
When you "hit" the SELECT statement it's evaluated and the program jumps directly to the correct CASE and executes that. When you have a bunch of IF/THEN each and every IF statement "in the list" is evaluated and the ones evaluated TRUE (if any will execute). With 320 IF statements it's going to take a different amount of time before the actual code in the "correct" IF/THEN block is executed depending on "where" in the list it is.
As for this code:
Code:
If B7 = 065 then Apt = 509: goto DispAlarm1 (DispAlarm1 would be for the first building)
If B7 = 082 then Apt = 018: goto DispAlarm2 (DispAlarm2 would be for the second building)
If B7 = 163 then Apt = 107: goto PrntRestore (The PrntRestore routine simply time stamps the return to normal)
Is the GOTO meant to execute only when the IF statement on the same line is true? If so I wonder if it does? I ask because to me (which does not mean it's correct, hence the question) the above looks the equivalent of
Code:
If B7 = 065 THEN Apt = 509
GOTO DispAlarm1
Meaning that the GOTO will execute unconditionally. If the GOTO should execute only when the IF statement is true I would have expected it to be
Code:
If B7 = 065 THEN
Apt = 509
GOTO DispAlarm1
ENDIF
Could you clarify this for me?
/Henrik.
Bookmarks