?/0 ERROR
Dragon Data Dragon 32/64
Severity: MinorWhat Does This Error Mean?
?/0 ERROR means your program tried to divide a number by zero. Mathematically undefined, BASIC stops immediately when it encounters this. Add an IF check before the division to guard against a zero denominator.
Affected Models
- Dragon 32
- Dragon 64
- Dragon 200E
- XRoar emulator
Common Causes
- Hard-coded division by zero: LET X = 10 / 0
- A variable used as a divisor that the user entered as zero
- A loop variable that reaches zero and is used in a denominator
- A formula where an intermediate calculation produces zero
How to Fix It
-
Find the division statement causing the error using the line number in the error message.
BASIC shows the line number: ?/0 ERROR IN 80 means line 80 has the division. Type LIST 80 to view that line.
-
Add an IF check to guard against zero before dividing.
Example fix: 80 IF B = 0 THEN PRINT "Cannot divide by zero" : GOTO 100 85 LET X = A / B This skips the division when B is zero.
-
Check user INPUT statements that feed into calculations.
If the divisor comes from INPUT, add a validation loop: 10 INPUT "Enter value: "; B 20 IF B = 0 THEN PRINT "Enter a non-zero value" : GOTO 10 30 LET X = A / B
-
Trace loop variables that might reach zero.
A FOR loop counting DOWN can pass through zero. If a loop variable is used in division, add IF to skip when it is zero.
Frequently Asked Questions
Does division by zero always crash the Dragon BASIC program?
Yes. Unlike some later programming languages that return infinity or NaN, Microsoft BASIC on the Dragon halts immediately with ?/0 ERROR. You must guard against it explicitly.
What happens if I use MOD or integer division with zero on the Dragon?
Both / (division) and \ (integer division) produce ?/0 ERROR with a zero divisor. The MOD operator also causes ?/0 ERROR when the modulus is zero.