O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Mod Operator

Syntax

                  result = number1 Mod number2
number1, number2 (required; any)

A numeric expression

Return Value

Returns the modulus

Description

Returns the modulus, that is, the remainder when number1 is divided by number2. This return value is a non-negative integral data type.

Rules at a Glance

  • Floating point numbers are rounded to integers before the division.

  • If number1 or number2 is Nothing, then an error occurs.

  • The Mod operator returns the data type of number1 and number2 if they are the same type, or the widest data type of number1 and number2 if they are different.

Example

MsgBox(10 Mod 3)   ' returns 1

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required