News

VFP does not encounter error when dividing by zero

If there is a division by zero in VFP, for example from the command window: ? 10/0, no error is encountered, the result is "*********" For example, if a formula with these characteristics is defined, it ...

If there is a division by zero in VFP, for example from the command window:

? 10/0

No error is encountered, the result is "*********"

For example, if a formula with these characteristics is defined, it must be assured that the divisor is not zero.

Anyway, this can be verified:

a = 10/0 // the result is a number *************
b = str(a) // b is a string "*************"
If substr(b,1,1) = "*" // then the result does not exist
  
Msg(‘Error: Division by zero")
EndIf