MOD
This page was last modified 11:56, 16 May 2020 by Gdx. Based on work by Mars2000you.

Contents

Effect

Divides two expressions like as integers and returns the remainder as a result.

Note: It's the unique BASIC instruction made of alphabetical characters and corresponding to an arithmetical operator, but MSX-BASIC provides also 6 other arithmetical operators (without using of alphabetical characters) and 6 instructions corresponding to logical operators.

Syntax

<Number1> MOD <Number2>

Parameters

<Number1> and <Number2> must be integers numbers. They can be also a numeric variable, or mathematical expression.

Examples

PRINT 5 MOD 3
2
A=31 : B=13: C=A MOD B: PRINT C
5

Related to

Arithmetical Operators, AND, EQV, IMP, NOT, OR, XOR

Compatibility

MSX-BASIC 1.0 or higher