-= Operator

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

    #1

    -= Operator

    Hi to all, I have been desperatly trying to find out what the -=
    operator does. The funny thing is that Google doesn't allow -= in its
    queries, so it's hard to find...
  • News

    #2
    Re: -= Operator

    "Thorsten Adams" <thorsten.adams ki@hotmail.comw rote in message
    news:uynYdQq5HH A.1188@TK2MSFTN GP04.phx.gbl...
    Hi to all, I have been desperatly trying to find out what the -= operator
    does. The funny thing is that Google doesn't allow -= in its queries, so
    it's hard to find...
    For example

    Dim i as integer = 66
    dim j as integer = 33

    i -= 22 ' which is same as i = i - 22
    j += 33 ' which is same as j = j + 33

    ' i now = 44
    ' j now = 66


    --
    regards,
    Les Hay, Livingston, Scotland

    Comment

    • Thorsten Adams

      #3
      Re: -= Operator

      Super, thank you, Les!
      Regards,
      Thorsten

      Comment

      • Michel Posseth [MCP]

        #4
        Re: -= Operator

        as addition to Les Hay


        These operators are often found in loop constructs

        dim i as integer


        do while blabla

        i+=1 ( corresponds to i = i + 1)
        i-=1 ( corresponds to i = i - 1)

        Loop

        it just saves you some typing

        regards

        Michel


        "Thorsten Adams" <thorsten.adams ki@hotmail.coms chreef in bericht
        news:%23Cm44dq5 HHA.5984@TK2MSF TNGP04.phx.gbl. ..
        Super, thank you, Les!
        Regards,
        Thorsten

        Comment

        • Fabio

          #5
          Re: -= Operator

          "Michel Posseth [MCP]" <msnews@posseth .comha scritto nel messaggio
          news:%23XSzWFw5 HHA.5268@TK2MSF TNGP02.phx.gbl. ..
          These operators are often found in loop constructs
          >
          dim i as integer
          >
          >
          do while blabla
          >
          i+=1 ( corresponds to i = i + 1)
          i-=1 ( corresponds to i = i - 1)
          >
          Loop
          >
          it just saves you some typing
          In loops is better again

          i++
          i--

          for (int i = 0; i < 10; i++)

          :)


          --
          Help The New .Net Site! http://www.devbox4.net


          Comment

          • Jack Jackson

            #6
            Re: -= Operator

            On Sat, 25 Aug 2007 23:52:22 +0200, "Fabio" <znt.fabio@virg ilio.it>
            wrote:
            >"Michel Posseth [MCP]" <msnews@posseth .comha scritto nel messaggio
            >news:%23XSzWFw 5HHA.5268@TK2MS FTNGP02.phx.gbl ...
            >
            >These operators are often found in loop constructs
            >>
            >dim i as integer
            >>
            >>
            >do while blabla
            >>
            >i+=1 ( corresponds to i = i + 1)
            >i-=1 ( corresponds to i = i - 1)
            >>
            >Loop
            >>
            >it just saves you some typing
            >
            >In loops is better again
            >
            >i++
            >i--
            >
            >for (int i = 0; i < 10; i++)
            >
            >:)
            But that is C syntax, not VB. VB doesn't have ++ and --.

            Comment

            • Fabio

              #7
              Re: -= Operator

              "Jack Jackson" <jacknospam@peb bleridge.comha scritto nel messaggio
              news:cga1d3l8r7 l84c4k1hu3a7hns rbns4co7b@4ax.c om...
              >
              But that is C syntax, not VB. VB doesn't have ++ and --.
              >
              Acc... you're right :P
              It's a C# syntax (and all others languages except VB :P )

              --
              Help The New .Net Site! http://www.devbox4.net


              Comment

              Working...