I haven’t really understood the difference between

i++ and ++i

  • stopit
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    my understanding…(I’m very new and trying to learn) - is that there would be no difference if that statement (i++; or ++i;) were used alone on a line…am I correct in this?

    • freely
      link
      fedilink
      arrow-up
      2
      ·
      3 years ago

      If both were the only statement, then yes they are equivalent because nothing is being done with the returned value either way. The difference only really matters if you’re using the returned value.