On Aug 22, 2006, at 12:52 PM, Terry Ford wrote:


On Aug 22, 2006, at 12:20 PM, Terry Ford wrote:

Actually, if you don't use AutoComplete, have no unnecessary spaces and consider the full Statements:

Select Case True
 Case Y<100
    startY=0
    endY=100
 Case Y>=100 and Y<200
    startY=100
    endY=200
End Select

vs.

If Y<100 Then
    startY=0
    endY=100
ElseIf Y>=100 and Y<200 Then
    startY=100
    endY=200
End If


But why do we need Y>=100 in the Elseif when we know that Y>=100 because Y<100 was false?

Replicating the logic (in reverse) runs the risk of an error if the code is changed (in only one place) later on.

Cheers,
  Malcolm Smith

then the If...Then wins by 10 less keystrokes; 4 if you eliminate Select or If in the End lines. :)

Sometimes the older ways work better. The *true* value of Select Case is more powerful when the problem isn't as simple as this one was.

Still, I learned something new by this thread; which is always good. :)

Cheers,

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to