Integer Division

Just as the backslash (/) is the division operator, the forward slash () is the integer division operator. Use it when you need to divide numbers but require the result to be an integer.

Intdivision

Beware that the numbers are rounded before the division takes place. For that reason, I’ve never seen a need to use this operator with non-integer numbers.

6 Comments

  1. ross says:

    Oooch, I wouldn’t touch that with a rats tail.

  2. Peter says:

    I thought that tis was the backslash: \
    and this this the forward slash: / (into the reading direction)

    Then again, nothing surprises me nowadays, so if it turns out I’m wrong, so be it.

    Peter

  3. Also, note that integer division with “” is performed *after* normal division and multiplication, as I noted recently in my blog:

    http://www.tallent.us/blog/CommentView.aspx?guid=c41bd09e-2d2f-4a5c-a959-3062793c1bc3

  4. Dan says:

    Peter - You’re right this is forward slash - / and this is backslash \

  5. john says:

    I\’l be back… :)U

  6. Chad Garrett says:

    Man, 4 years and the forward slash, back slash thing still isn’t corrected.

Leave a Reply