|
|
Subject:
"Select Case" VS "Elseif"
Category: Computers > Programming Asked by: clubknowledge-ga List Price: $10.00 |
Posted:
18 May 2006 06:02 PDT
Expires: 22 May 2006 09:53 PDT Question ID: 730033 |
Which is better in terms of performance & memory usage, which is higher performance and less memory usage? "Select Case" VS "Elseif" The language I am asking about is VB6. |
|
There is no answer at this time. |
|
Subject:
Re: "Select Case" VS "Elseif"
From: nuclearw-ga on 18 May 2006 09:37 PDT |
I don't believe there is a noticeable difference with today?s systems, the main difference how easy it is to read the code. Select case us much less cluttered if you have several cases to work with. |
Subject:
Re: "Select Case" VS "Elseif"
From: popoff-ga on 18 May 2006 16:55 PDT |
One thing to note however, is the following: A switch statement only needs to evaluate once, while if you have multiple if statments asking the same thing, they have to evaluate more than once. For example: Select Case 1 + 3 Case 1: MsgBox "1" Case 2: MsgBox "2" Case 3: MsgBox "3" Case 4: MsgBox "4" Case Default: MsgBox "Default" End Select If 1 + 3 = 1 Then MsgBox "1" ElseIf 1 + 3 = 2 Then MsgBox "2" ElseIf 1 + 3 = 3 Then MsgBox "3" ElseIf 1 + 3 = 4 Then MsgBox "4" End If The select case only had to evaluate 1+3 once while the if had to do it 4 times. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |