Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
If...Then...Else
Old
  (#1)
Craig
Guest
 
Posts: n/a
Default If...Then...Else - 06-04-2007, 09:46 AM

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
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: If...Then...Else
Old
  (#2)
Bob Butler
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:46 AM

"Craig" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED 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"

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#3)
Larry Serflaten
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:46 AM


"Craig" <EMAIL REMOVED> wrote in message news:EMAIL REMOVED 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

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#4)
arko
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM

OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
in my own programs.


"Craig" <EMAIL REMOVED> schreef in bericht
news:EMAIL REMOVED 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



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#5)
steve
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM

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" <EMAIL REMOVED> wrote in message
news:412c7318$0$3342$EMAIL REMOVED4all .nl...
| OMG.. This is brilliant code! Hope you dont mind I copy it so I can use it
| in my own programs.
|
|
| "Craig" <EMAIL REMOVED> schreef in bericht
| news:EMAIL REMOVED 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
|
|


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#6)
AustinMN
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM

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

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#7)
DaveO
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM


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


---------------------------------------------------
"AustinMN" <EMAIL REMOVED> wrote in message
news:nM1Xc.515083$EMAIL REMOVED...
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


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#8)
AustinMN
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM


"DaveO" <EMAIL REMOVED> wrote in message
news:cgifge$m1l$EMAIL REMOVED...
>
> MAYBE we can even get this new thing to say "HELLO" ??


Let's not get greedy!

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: If...Then...Else
Old
  (#9)
steve
Guest
 
Posts: n/a
Default Re: If...Then...Else - 06-04-2007, 09:48 AM

still roflmao!


"AustinMN" <EMAIL REMOVED> wrote in message
news:1n6Xc.247658$EMAIL REMOVED...
|
| "DaveO" <EMAIL REMOVED> wrote in message
| news:cgifge$m1l$EMAIL REMOVED...
| >
| > MAYBE we can even get this new thing to say "HELLO" ??
|
| Let's not get greedy!
|


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top