Div.n

From AGI Wiki
Revision as of 11:34, 30 March 2019 by Andrew Korson (talk | contribs) (Created page with "The '''div.n''' command divides a variable by a number. == Syntax == div.n(var vA, byt B);<br /> vA = vA / B;<br /> vA /= B; == Remarks == The resu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The div.n command divides a variable by a number.

Syntax

div.n(var vA, byt B);
vA = vA / B;
vA /= B;

Remarks

The results of the division are rounded down (i.e. the result is truncated).

Possible Errors

AGI does not check for a divide by zero error. If an attempt is made to divide by zero, AGI will crash. Don't do it. EVER. You have been warned.

Example

Code:

<syntaxhighlight lang="agi"> v50 = 85; div.n(v50, 5); [ v50 == 17 v50 /= 5; [ now v50 == 3 </syntaxhighlight>

Technical Information

Required Interpreter Version: Available in version 2.411 and above.
Byte-Code Value: 167 (0xA7 hex)

See Also

Mathematical Commands
div.v