locked
Integer Division "\" in Small Basic RRS feed

  • Question

  • Hello everyone,

    Can someone please advise me on how to do integer division in Small Basic? For example in VB.NET, I could write something like z = 2 \ 3 in order to do integer division. However, the "\" operator doesn't exist in Small Basic. Is there an equivalent to "\" operator in Small Basic? I know that the "/" symbol does regular division.

    Thanks everyone.

    -Anthony


    • Edited by ayarrell Thursday, February 9, 2012 4:24 PM
    Thursday, February 9, 2012 4:23 PM

Answers

  • Thanks, litdev for such a quick response. I will try it.

    • Marked as answer by ayarrell Monday, February 13, 2012 3:31 PM
    Friday, February 10, 2012 9:28 PM

All replies

  • Perhaps, z = Math.Floor(2/3) which does regular division and then truncates (rounds down) to an integer.

    Thursday, February 9, 2012 5:17 PM
  • Thanks, litdev for such a quick response. I will try it.

    • Marked as answer by ayarrell Monday, February 13, 2012 3:31 PM
    Friday, February 10, 2012 9:28 PM