08-13-2024, 09:46 PM
(08-12-2024, 06:34 PM)Dimster Wrote: In terms of efficiency, do you guys avoid logical operators in Select Cases? Meaning the simpler the case operant the more efficient the code.
I'd have to see an example to figure that one out.
What I can say is I like to use simple algorithms to substitute for conditional statments whenever possible.
For instance, instead of...
Code: (Select All)
Do
_Limit 30
b$ = InKey$
Select Case UCase$(b$)
Case "A" To "Z"
If UCase$(b$) = "A" Then Print "1"
If UCase$(b$) = "B" Then Print "2"
If UCase$(b$) = "C" Then Print "3"
''' etc.
End Select
Loop Until b$ = Chr$(27)
I'd code...
Code: (Select All)
Do
_Limit 30
b$ = InKey$
Select Case UCase$(b$)
Case "A" To "Z"
Print LTrim$(Str$(Asc(UCase$(b$)) - 64))
End Select
Loop Until b$ = Chr$(27)
Pete
Shoot first and shoot people who ask questions, later.