I am curious to know which IF statement below is better. strQCType
could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the
IF statements to execute only in the event of an "LCS" or "MS".
If ((strQCType = "LCS") Or (strQCType = "MS")) Then
End If
-OR-
If (strQCType = "LCS") Or (strQCType = "MS") Then
End If
Thanks,
Vint 13 1059 v.*****@comcast.net wrote:
I am curious to know which IF statement below is better. strQCType
could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the
IF statements to execute only in the event of an "LCS" or "MS".
If ((strQCType = "LCS") Or (strQCType = "MS")) Then
End If
-OR-
If (strQCType = "LCS") Or (strQCType = "MS") Then
End If
Thanks,
Vint
Personally, it makes no difference.
--
Tom Shelton
I am curious to know which IF statement below is better. strQCType
could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the
IF statements to execute only in the event of an "LCS" or "MS".
If I am not missing something, they are the same. That brackets don't
make the difference. Quicker version would be:
If (strQCType = "LCS") OrElse (strQCType = "MS") Then
End If
--
Pozdrav,
Josip Medved http://www.jmedved.com
"Josip Medved" <jm*****@jmedved.comschrieb:
>I am curious to know which IF statement below is better. strQCType could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the IF statements to execute only in the event of an "LCS" or "MS".
If I am not missing something, they are the same. That brackets don't
make the difference. Quicker version would be:
If (strQCType = "LCS") OrElse (strQCType = "MS") Then
End If
ACK, that's what I'd use too. Most developers coming from VB6 still use
'Or' even if 'OrElse' makes more sense...
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Tom,
:-) I am sure you missed that Or.
Cor
"Tom Shelton" <to*@mtogden.comschreef in bericht
news:11*********************@k70g2000cwa.googlegro ups.com...
> v.*****@comcast.net wrote:
>I am curious to know which IF statement below is better. strQCType could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the IF statements to execute only in the event of an "LCS" or "MS".
If ((strQCType = "LCS") Or (strQCType = "MS")) Then
End If
-OR-
If (strQCType = "LCS") Or (strQCType = "MS") Then
End If
Thanks, Vint
Personally, it makes no difference.
--
Tom Shelton
Hi,
Beside the OrElse and removing all parenthises you have to investigate what
is used the most, that has be the first thing to investigate, that will at
least save you 1 picosecond when 1000000000000 times used.
However, all kind of investigating time used in this kind of question can in
my idea never be gained by the time the program is going faster.
Just my thought.
Cor
<v.*****@comcast.netschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
>I am curious to know which IF statement below is better. strQCType
could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the
IF statements to execute only in the event of an "LCS" or "MS".
If ((strQCType = "LCS") Or (strQCType = "MS")) Then
End If
-OR-
If (strQCType = "LCS") Or (strQCType = "MS") Then
End If
Thanks,
Vint
Herfried,
Can you explain too me why you are using this and not simple.
If strQCType = "LCS" OrElse strQCType = "MS" Then
I am curious about you answer, I don't see any benefit from what (you tell)
you are doing.
Cor
"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:us**************@TK2MSFTNGP05.phx.gbl...
"Josip Medved" <jm*****@jmedved.comschrieb:
>>I am curious to know which IF statement below is better. strQCType could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the IF statements to execute only in the event of an "LCS" or "MS".
If I am not missing something, they are the same. That brackets don't make the difference. Quicker version would be:
If (strQCType = "LCS") OrElse (strQCType = "MS") Then
End If
ACK, that's what I'd use too. Most developers coming from VB6 still use
'Or' even if 'OrElse' makes more sense...
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
v.*****@comcast.net wrote:
I am curious to know which IF statement below is better. strQCType
could be "LCS", "MS", "REG", "LD", or "LB". I want the code within the
IF statements to execute only in the event of an "LCS" or "MS".
Personally, I wouldn't use an If for this at all!
Select Case strQCType
Case "LCS", "MS"
' Do Useful stuff
Case Else
' Do Something Else
End Select
IMHO it's more readible and, when you later decide that you need to do
this processing for "REG" as well, it's far easier to change reliably.
HTH,
Phill W.
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
Can you explain too me why you are using this and not simple.
If strQCType = "LCS" OrElse strQCType = "MS" Then
I am curious about you answer, I don't see any benefit from what (you
tell) you are doing.
I would not write the '(...)' too, but writing the '(...)' may improve
readability for those who do not have the exact rules for operator
precedence in their mind.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:uz**************@TK2MSFTNGP04.phx.gbl...
:
: "Cor Ligthert [MVP]" <no************@planet.nlschrieb:
: >
: Can you explain too me why you are using this and not simple.
: >
: If strQCType = "LCS" OrElse strQCType = "MS" Then
: >
: I am curious about you answer, I don't see any benefit from what (you
: tell) you are doing.
:
: I would not write the '(...)' too, but writing the '(...)' may improve
: readability for those who do not have the exact rules for operator
: precedence in their mind.
I tend to do that. The (..) are superfluous, but they do clarify what is
happening. And I'm all for being clear about my intentions when coding.
These two statement are equivalent:
[1] If Not A AndAlso B Then
[2] If (Not A) AndAlso (B) Then
However, I find the second contruction to be clearer. It explicitly prevents
the reader from interpreting this as
[3] If Not (A AndAlso B) Then
If I did in fact intend this third implementation, it is immediately obvious
if that is what I achieved. I don't know how many times I've had to debug
code where I've run into just this type of error. Adding the (...) would
have prevented that right up front.
I don't always bother for small, throw away code. But when I'm working in a
team environment, I personally like using (...), superfluous or not, because
it makes my intentions clear to the other coders.
Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
----------------------------------------------------------
There are no advanced students in Aikido - there are only
competent beginners. There are no advanced techniques -
only the correct application of basic principles.
Cor Ligthert [MVP] wrote:
Tom,
:-) I am sure you missed that Or.
Cor
Yes, I did. I only saw the parens. That's what comes of not doing VB
every day :)
--
Tom Shelton
Herfried,
A good question for you , all that is inside a () should be processed
first.
Is this processed before the check on OrElse.
In my opinion it should but than be not direct not wanted behaviour.
Just my thought, and a nice question for you in my idea.
Cor
"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:uz**************@TK2MSFTNGP04.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
>Can you explain too me why you are using this and not simple.
If strQCType = "LCS" OrElse strQCType = "MS" Then
I am curious about you answer, I don't see any benefit from what (you tell) you are doing.
I would not write the '(...)' too, but writing the '(...)' may improve
readability for those who do not have the exact rules for operator
precedence in their mind.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
A good question for you , all that is inside a () should be processed
first.
Is this processed before the check on OrElse.
In my opinion it should but than be not direct not wanted behaviour.
Just my thought, and a nice question for you in my idea.
Inside of all () is not processed before OrElse.
If (something1) OrElse (something2) Then
and
If something1 OrElse something2 Then
are completely the same. You can test it. :)
--
Greetings,
Josip Medved http://www.jmedved.com
Josip,
Thanks
I would have done it, but yesterday I had no time for this, and if you say
it, why would I not believe you?
Cor
"Josip Medved" <jm*****@jmedved.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
>A good question for you , all that is inside a () should be processed first. Is this processed before the check on OrElse. In my opinion it should but than be not direct not wanted behaviour. Just my thought, and a nice question for you in my idea.
Inside of all () is not processed before OrElse.
If (something1) OrElse (something2) Then
and
If something1 OrElse something2 Then
are completely the same. You can test it. :)
--
Greetings,
Josip Medved http://www.jmedved.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Trebor A. Rude |
last post by:
I'm new to Perl (although I have about 7 years of C++ experience), and I was
just wondering which of these two equivalent statements the group thinks is
"better", and why:
push @command, map...
|
by: Rabbit63 |
last post by:
Hi:
I want to show a set of records in the database table on the clicnt browser.
I have two ways to do this (writen in JScript):
1.The first way is:
<%
var sql = "select firstname from...
|
by: Geetesh |
last post by:
Recently i saw a code in which there was a structer defination similar
as bellow:
struct foo
{
int dummy1;
int dummy2;
int last
};
In application the above array is always allocated at...
|
by: Skybuck Flying |
last post by:
Hi,
I needed a method to determine if a point was on a line segment in 2D. So I
googled for some help and so far I have evaluated two methods.
The first method was only a formula, the second...
|
by: Jon S via DotNetMonster.com |
last post by:
Hi all,
I'm planning on developing an ASP.NET web site. I know both VB.NET and C#
but am unsure on which would be more useful to develop an ASP.NET site with?
Also I maybe looking to become a...
|
by: Protoman |
last post by:
Which is better for general-purpose programming, C or C++? My friend
says C++, but I'm not sure. Please enlighten me. Thanks!!!!!
|
by: zefciu |
last post by:
In the tutorial there is an example iterator class that revesrses the
string given to the constructor. The problem is that this class works
only once, unlike built-in types like string. How to...
|
by: Tarun |
last post by:
Hello,
I am facing problem sometimes while I am trying to do push_back on a
vector. Currently I am doing resize of the vector increasing the size
by one and then push_back and seems like the...
|
by: mike3 |
last post by:
Hi.
(Xposted to both comp.lang.c++ and comp.programming since I've got
questions related to both C++ language and general programming)
I've got the following C++ code. The first routine runs in...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |