Funny how late at night one gets stuck into a Select method without thinking of the obvious easy If solution
Funny how late at night one gets stuck into a Select method without thinking of the obvious easy If solution
But maybe the PICBASIC people could add the CASE x TO y variety that some BASICs have.
caverman, Why make a mountain out of a Mole hill. Just do this:
select case PulseLength
case is < 165
you don't want these values because they are below 165 so do something
case is < 176
OutValue=0
case is < 184
you don't want these values because they are between 176 and 184 so do something
case is < 192
OutValue=1
case else
you don't want these values because they are between 192 and 255 so do something
end select
This is the correct way as far as I can see to do this type of compare situation. If you were to use "IF" statements and try to capture all posibilities the code would look much different.
Dave Purola,
N8NTA
Why not using the statement below?
IF PulseLength > 165 AND PulseLength < 176 THEN
OutValue=0
ELSE
IF PulseLength > 184 OR PulseLength < 192 THEN OutValue=1
ENDIF
----------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Because the above compiles almost 2.5 times longer!Originally Posted by sayzer
Ioannis
If you meant the size in terms of the words used,
I had 103 words with "IF" statement and 110 words with "Select Case" statement.
How did you have 2.5 times more words?
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks