Help Center
Help CenterFreeBASIC

Operator Mod= (Modulus And Assign)operator

Divides a value and assigns the remainder to a variable

Operatorsoperatordocumented

Syntax

Declare Operator Mod= ( ByRef lhs As Integer, ByRef rhs As Integer )

Parameters

NameDescription
lhsThe variable to assign to.
rhsThe value to divide
lhsby.

Description


This operator divides two values of Integer type and assigns the remainder to its left-hand side (lhs) variable. It is functionally equivalent to:
lhs = lhs Mod rhs

This operator can be overloaded for user-defined types as a member Operator using the appropriate syntax.

Note: Similarly to the operator '=[>]' (assign), the alternative symbol 'Mod=>' can be also used.

Remarks

Usage


lhs Mod= rhs

Dialect Differences


  • In the -lang qb dialect, this operator cannot be overloaded.

Differences from QB


  • New to FreeBASIC

See also


Example


Dim n As Integer

n = 11

n Mod= 3

'' The result is 2

Print n

Sleep


Reference

  • Documented in KeyPgOpCombineModulus.html