If...Then...Else

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Craig

    If...Then...Else

    I want to compare several items and if they are all equal then do
    this...otherwis e do this...see example below...

    If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
    ..Code..
    Else
    ..Code..
    End If
  • Bob Butler

    #2
    Re: If...Then...Els e

    "Craig" <craig.a.mcguir e@verizon.com> wrote in message
    news:106c9c93.0 408170920.52cfe 605@posting.goo gle.com[color=blue]
    > I want to compare several items and if they are all equal then do
    > this...otherwis e 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"

    Comment

    • Larry Serflaten

      #3
      Re: If...Then...Els e


      "Craig" <craig.a.mcguir e@verizon.com> wrote in message news:106c9c93.0 408170920.52cfe 605@posting.goo gle.com...[color=blue]
      > I want to compare several items and if they are all equal then do
      > this...otherwis e 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

      Comment

      • arko

        #4
        Re: If...Then...Els e

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


        "Craig" <craig.a.mcguir e@verizon.com> schreef in bericht
        news:106c9c93.0 408170920.52cfe 605@posting.goo gle.com...[color=blue]
        > I want to compare several items and if they are all equal then do
        > this...otherwis e do this...see example below...
        >
        > If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
        > ..Code..
        > Else
        > ..Code..
        > End If[/color]


        Comment

        • steve

          #5
          Re: If...Then...Els e

          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"...li ke "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.x s4all.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.mcguir e@verizon.com> schreef in bericht
          | news:106c9c93.0 408170920.52cfe 605@posting.goo gle.com...
          | > I want to compare several items and if they are all equal then do
          | > this...otherwis e do this...see example below...
          | >
          | > If (a = a) AND (b = b) AND (c = c) AND (d = d) Then
          | > ..Code..
          | > Else
          | > ..Code..
          | > End If
          |
          |


          Comment

          • AustinMN

            #6
            Re: If...Then...Els e

            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"...li ke "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

            Comment

            • DaveO

              #7
              Re: If...Then...Els e


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


              ---------------------------------------------------
              "AustinMN" <tacooperX@Xatt .net> wrote in message
              news:nM1Xc.5150 83$Gx4.426892@b gtnsc04-news.ops.worldn et.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"...li ke "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


              Comment

              • AustinMN

                #8
                Re: If...Then...Els e


                "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!

                Comment

                • steve

                  #9
                  Re: If...Then...Els e

                  still roflmao!


                  "AustinMN" <tacooperX@Xatt .net> wrote in message
                  news:1n6Xc.2476 58$OB3.222892@b gtnsc05-news.ops.worldn et.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!
                  |


                  Comment

                  Working...