471,083 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,083 software developers and data experts.

If...Then...Else

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
8 10413
"Craig" <cr*************@verizon.com> wrote in message
news:10**************************@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


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

"Craig" <cr*************@verizon.com> wrote in message news:10**************************@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


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
OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
in my own programs.
"Craig" <cr*************@verizon.com> schreef in bericht
news:10**************************@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 #4
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" <ar**@arko.nl> wrote in message
news:41**********************@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" <cr*************@verizon.com> schreef in bericht
| news:10**************************@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
steve joked:
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


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

MAYBE we can even get this new thing to say "HELLO" ??
---------------------------------------------------
"AustinMN" <ta*******@Xatt.net> wrote in message
news:nM*********************@bgtnsc04-news.ops.worldnet.att.net...
steve joked:
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


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

"DaveO" <js******@mweb.co.za> wrote in message
news:cg**********@ctb-nnrp2.saix.net...

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


Let's not get greedy!

Jul 17 '05 #8
still roflmao!
"AustinMN" <ta*******@Xatt.net> wrote in message
news:1n*********************@bgtnsc05-news.ops.worldnet.att.net...
|
| "DaveO" <js******@mweb.co.za> wrote in message
| news:cg**********@ctb-nnrp2.saix.net...
| >
| > MAYBE we can even get this new thing to say "HELLO" ??
|
| Let's not get greedy!
|
Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by pbdev | last post: by
1 post views Thread by avital | last post: by
19 posts views Thread by GMKS | last post: by
14 posts views Thread by lawjake | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.