363,924 Members | 2585 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

If...Then...Else

Craig
P: n/a
Craig
I want to compare several items and if they are all equal then do
this...otherwise do this...see example below...

If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
..Code..
Else
..Code..
End If
Jul 17 '05 #1
Share this Question
Share on Google+
8 Replies


Bob Butler
P: n/a
Bob Butler
"Craig" <craig.a.mcguire@verizon.com> wrote in message
news:106c9c93.0408170920.52cfe605@posting.google.c om[color=blue]
> I want to compare several items and if they are all equal then do
> this...otherwise do this...see example below...
>
> If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
> ..Code..
> Else
> ..Code..
> End If[/color]

do you mean this?

if a=b and a=c and a=d then
' all equal
else
' not the same
end if


--
Reply to the group so all can participate
VB.Net... just say "No"

Jul 17 '05 #2

Larry Serflaten
P: n/a
Larry Serflaten

"Craig" <craig.a.mcguire@verizon.com> wrote in message news:106c9c93.0408170920.52cfe605@posting.google.c om...[color=blue]
> I want to compare several items and if they are all equal then do
> this...otherwise do this...see example below...
>
> If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
> ..Code..
> Else
> ..Code..
> End If[/color]

Unless one of those can be Null, according to the example,
you don't need the test. As shown it will always evaluate to
True....

LFS

Jul 17 '05 #3

arko
P: n/a
arko
OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
in my own programs.


"Craig" <craig.a.mcguire@verizon.com> schreef in bericht
news:106c9c93.0408170920.52cfe605@posting.google.c om...[color=blue]
> I want to compare several items and if they are all equal then do
> this...otherwise do this...see example below...
>
> If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
> ..Code..
> Else
> ..Code..
> End If[/color]


Jul 17 '05 #4

steve
P: n/a
steve
roflmao!

hey, wouldn't it be cool to also have a function that would allow you to
give it the values you wanted to compare against a variable and if a match
existed in the list...return a certain value? i think i'd call that function
"switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
too advanced for the technology we have today! after all, we've still gotta
work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another wish
list item i'd have would be maybe something called "SELECT". its purpose
would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of conditions
where you may want to execute code...maybe call the comparitor value a
"CASE"...like "in case this value is eq. to this other value".

but i digress, that's all just too far in the future.

lol



"arko" <arko@arko.nl> wrote in message
news:412c7318$0$3342$e4fe514c@dreader6.news.xs4all .nl...
| OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
| in my own programs.
|
|
| "Craig" <craig.a.mcguire@verizon.com> schreef in bericht
| news:106c9c93.0408170920.52cfe605@posting.google.c om...
| > I want to compare several items and if they are all equal then do
| > this...otherwise do this...see example below...
| >
| > If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
| > ..Code..
| > Else
| > ..Code..
| > End If
|
|


Jul 17 '05 #5

AustinMN
P: n/a
AustinMN
steve joked:[color=blue]
> roflmao!
>
> hey, wouldn't it be cool to also have a function that would allow you to
> give it the values you wanted to compare against a variable and if a
> match
> existed in the list...return a certain value? i think i'd call that
> function
> "switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
> too advanced for the technology we have today! after all, we've still
> gotta
> work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another
> wish
> list item i'd have would be maybe something called "SELECT". its purpose
> would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of
> conditions
> where you may want to execute code...maybe call the comparitor value a
> "CASE"...like "in case this value is eq. to this other value".
>
> but i digress, that's all just too far in the future.
>
> lol[/color]

I have a truly radical idea. Maybe we could have variables that could hold
different kinds of data! Like if you set it equal to a string, it would
become a string variable. If you set it to an integer, it would switch to
being an integer.

Wadaya think? Too difficult? Too strange a concept? Would it even be
useful, like if you didn't know what kind of data you were going to get?

If/Then/ElseIf/Else...I'll have to think about that one. We may be onto
something there. I think there's a problem, though. How will the compiler
know how many lies belong to the Else? I think it should have an EndIf or
something like that.

Austin
--
You programmed with 1s and 0s? We only had 0s!
There are no X characters in my address

Jul 17 '05 #6

DaveO
P: n/a
DaveO

MAYBE we can even get this new thing to say "HELLO" ??


---------------------------------------------------
"AustinMN" <tacooperX@Xatt.net> wrote in message
news:nM1Xc.515083$Gx4.426892@bgtnsc04-news.ops.worldnet.att.net...
steve joked:[color=blue]
> roflmao!
>
> hey, wouldn't it be cool to also have a function that would allow you to
> give it the values you wanted to compare against a variable and if a
> match
> existed in the list...return a certain value? i think i'd call that
> function
> "switch-a-roo"...maybe just "SWITCH". but that's years down the line...way
> too advanced for the technology we have today! after all, we've still
> gotta
> work out how this "IF THEN ELSE ELSEIF" stuff is going to work! another
> wish
> list item i'd have would be maybe something called "SELECT". its purpose
> would be to unclutter IF/THEN/ELSEIF/ELSE when you had a bunch of
> conditions
> where you may want to execute code...maybe call the comparitor value a
> "CASE"...like "in case this value is eq. to this other value".
>
> but i digress, that's all just too far in the future.
>
> lol[/color]

I have a truly radical idea. Maybe we could have variables that could hold
different kinds of data! Like if you set it equal to a string, it would
become a string variable. If you set it to an integer, it would switch to
being an integer.

Wadaya think? Too difficult? Too strange a concept? Would it even be
useful, like if you didn't know what kind of data you were going to get?

If/Then/ElseIf/Else...I'll have to think about that one. We may be onto
something there. I think there's a problem, though. How will the compiler
know how many lies belong to the Else? I think it should have an EndIf or
something like that.

Austin
--
You programmed with 1s and 0s? We only had 0s!
There are no X characters in my address


Jul 17 '05 #7

AustinMN
P: n/a
AustinMN

"DaveO" <jsinvest@mweb.co.za> wrote in message
news:cgifge$m1l$1@ctb-nnrp2.saix.net...[color=blue]
>
> MAYBE we can even get this new thing to say "HELLO" ??[/color]

Let's not get greedy!

Jul 17 '05 #8

steve
P: n/a
steve
still roflmao!


"AustinMN" <tacooperX@Xatt.net> wrote in message
news:1n6Xc.247658$OB3.222892@bgtnsc05-news.ops.worldnet.att.net...
|
| "DaveO" <jsinvest@mweb.co.za> wrote in message
| news:cgifge$m1l$1@ctb-nnrp2.saix.net...
| >
| > MAYBE we can even get this new thing to say "HELLO" ??
|
| Let's not get greedy!
|


Jul 17 '05 #9

Post your reply

Help answer this question



Didn't find the answer to your Visual Basic 4 / 5 / 6 question?

You can also browse similar questions: Visual Basic 4 / 5 / 6