"&" and "+" Q:

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Option^Explicit

    "&" and "+" Q:

    Can anyone tell me what the difference between using one or the other of
    these.?
    From what I have read they are the same thing, and both seem to do the same
    job.

    ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"

    I have noticed however when copying code from the API guide especially,
    using "+" when modifying the code sometimes ends up with error until you
    change to "&"

    Anyone know what the standard is to use, and what the difference is if any?


  • Raoul Watson

    #2
    Re: "&&quo t; and "+&quot ; Q:


    "Option^Explici t @shaw.ca>" <fu-q<remspam> wrote in message
    news:ySr7c.1208 95$Up2.45480@pd 7tw1no...[color=blue]
    > Can anyone tell me what the difference between using one or the other of
    > these.?
    > From what I have read they are the same thing, and both seem to do the[/color]
    same[color=blue]
    > job.
    >
    > ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"
    >
    > I have noticed however when copying code from the API guide especially,
    > using "+" when modifying the code sometimes ends up with error until you
    > change to "&"
    >
    > Anyone know what the standard is to use, and what the difference is if[/color]
    any?[color=blue]
    >
    >[/color]

    They're both concatenation symbol. The "+" was maintained for backwards
    compatibility with QuickBasic. To avoid confusion with math operation the
    ampersand "&" is prefered.


    Comment

    • Option^Explicit

      #3
      Re: &quot;&amp;&quo t; and &quot;+&quot ; Q:

      Thanks for that Raoul.


      "Raoul Watson" <WatsonR@Intell igenCIA.com> wrote in message
      news:Ogs7c.4470 $vC.1713@nwrdny 03.gnilink.net. ..[color=blue]
      >
      > "Option^Explici t @shaw.ca>" <fu-q<remspam> wrote in message
      > news:ySr7c.1208 95$Up2.45480@pd 7tw1no...[color=green]
      > > Can anyone tell me what the difference between using one or the other of
      > > these.?
      > > From what I have read they are the same thing, and both seem to do the[/color]
      > same[color=green]
      > > job.
      > >
      > > ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"
      > >
      > > I have noticed however when copying code from the API guide especially,
      > > using "+" when modifying the code sometimes ends up with error until you
      > > change to "&"
      > >
      > > Anyone know what the standard is to use, and what the difference is if[/color]
      > any?[color=green]
      > >
      > >[/color]
      >
      > They're both concatenation symbol. The "+" was maintained for backwards
      > compatibility with QuickBasic. To avoid confusion with math operation the
      > ampersand "&" is prefered.
      >
      >[/color]


      Comment

      • J French

        #4
        Re: &quot;&amp;&quo t; and &quot;+&quot ; Q:

        On Mon, 22 Mar 2004 02:06:22 GMT, "Option^Explici t"
        <fu-q<remspam>@shaw .ca> wrote:
        [color=blue]
        >Can anyone tell me what the difference between using one or the other of
        >these.?
        >From what I have read they are the same thing, and both seem to do the same
        >job.
        >
        >ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"
        >
        >I have noticed however when copying code from the API guide especially,
        >using "+" when modifying the code sometimes ends up with error until you
        >change to "&"[/color]

        '&' is an 'addition' to BASIC, generously provided by Microsoft in (I
        think) VB4

        It adds together strings .. and most simple variables
        ie: it sneakily turns numbers into strings

        A$ = "SomeText" & 666

        '+' is the original method of concatenating Strings, and will throw an
        error if you try to 'add' numbers to Strings
        - which helps cut down on errors

        '&' is the 'trendy' way of doing things
        '+' is the normal way in languages that support string concatenation
        using an operator

        Comment

        • Larry Serflaten

          #5
          Re: &quot;&amp;&quo t; and &quot;+&quot ; Q:


          "Option^Explici t @shaw.ca>" <fu-q<remspam> wrote[color=blue]
          > Can anyone tell me what the difference between using one or the other of
          > these.?
          > From what I have read they are the same thing, and both seem to do the same
          > job.
          >
          > ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"
          >
          > I have noticed however when copying code from the API guide especially,
          > using "+" when modifying the code sometimes ends up with error until you
          > change to "&"
          >
          > Anyone know what the standard is to use, and what the difference is if any?[/color]


          Try these, then decide which you'd prefer to use:

          Debug.Print "2" + 2
          Debug.Print "2" & 2

          LFS




          -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

          Comment

          • Option^Explicit

            #6
            Re: &quot;&amp;&quo t; and &quot;+&quot ; Q:

            Now it all makes sense. and explains the errors as well.
            good answers :)

            "J French" <erewhon@nowher e.com> wrote in message
            news:405ea0af.1 [email protected] tclick.com...[color=blue]
            > On Mon, 22 Mar 2004 02:06:22 GMT, "Option^Explici t"
            > <fu-q<remspam>@shaw .ca> wrote:
            >[color=green]
            > >Can anyone tell me what the difference between using one or the other of
            > >these.?
            > >From what I have read they are the same thing, and both seem to do the[/color][/color]
            same[color=blue][color=green]
            > >job.
            > >
            > >ie: CurDir + "\myfile.ex e" or CurDir & "\myfile.ex e"
            > >
            > >I have noticed however when copying code from the API guide especially,
            > >using "+" when modifying the code sometimes ends up with error until you
            > >change to "&"[/color]
            >
            > '&' is an 'addition' to BASIC, generously provided by Microsoft in (I
            > think) VB4
            >
            > It adds together strings .. and most simple variables
            > ie: it sneakily turns numbers into strings
            >
            > A$ = "SomeText" & 666
            >
            > '+' is the original method of concatenating Strings, and will throw an
            > error if you try to 'add' numbers to Strings
            > - which helps cut down on errors
            >
            > '&' is the 'trendy' way of doing things
            > '+' is the normal way in languages that support string concatenation
            > using an operator
            >[/color]


            Comment

            Working...