Can someone explain the 'mod' operator in VB.net in the simplest way possible?

35,171

Mod in VB.NET is the Modulo operation. It returns the remainder when one number is divided by another.

For example, if you divided 4 by 2, your mod result would be 0 (no remainder). If you divided 5 by 2, your mod result would be 1.

Explanation of the Modulo operation

Share:
35,171
JoeS
Author by

JoeS

Updated on September 29, 2020

Comments

  • JoeS
    JoeS over 3 years

    I have this code I need to explain and the Mod operator has confused me, MSDN has a page on it and I cannot understand it clearly. I have included a section of code below if you could refer to it in your answer, thanks.

    number1 = (input1/ 10) - 0.5
    number2 = input2 Mod 10
    
    Result = number1 + number2