|
-
Mar 31st, 2004, 10:19 AM
#1
Thread Starter
Frenzied Member
problem understanding andalso
I have a statement that I am using two NOT operators.
can this be simplified using a 'andalso'?
VB Code:
If Not rs.BOF And Not rs.EOF Then
VB Code:
If Not rs.BOF AndAlso rs.EOF Then
-
Mar 31st, 2004, 10:22 AM
#2
Fanatic Member
-
Mar 31st, 2004, 10:29 AM
#3
Thread Starter
Frenzied Member
cool. I thought so but reading in the msdn confused me a TAD lol
it says that if the first expression evaluates to false, the second is considered false. in my case, the evaluation would be negated with that NOT operator. I dont like using NOT but I am converting some vb6 code another developer had.
thanks!!
-
Mar 31st, 2004, 04:42 PM
#4
PowerPoster
I don't think that the AndAlso will have any effect on the Not operator. The difference between And and AndAlso is that And will evaluate both parts of the expression even if the first part is false, whereas AndAlso will skip to the next instruction if the fist part is false. So all it does is improve performance a little bit.
-
Mar 31st, 2004, 06:02 PM
#5
yay gay
I think C# uses AndAlso by default right?
\m/  \m/
-
Mar 31st, 2004, 06:47 PM
#6
I wonder how many charact
Originally posted by PT Exorcist
I think C# uses AndAlso by default right?
I would assume so... if its modeled after Java... but then again, its basically the same as using:
VB Code:
If x = True Then
If y = True Then
'do something
z=True
End If
End If
or
VB Code:
If (x AndAlso y) Then z=True
Code:
//C#
If (x && y)
//do something
z=true;
Last edited by nemaroller; Mar 31st, 2004 at 06:51 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|