Detect division by zero: Difference between revisions
m
→{{header|V (Vlang)}}
(Added GW-BASIC and MSX Basic) |
|||
Line 2,544:
fn divide(x f64, y f64) {
result := x/y
if result.str().contains_any_substr([
println("Can\'t divide by zero!
return
}
Line 2,571:
fn divide_error_handler(x f64, y f64) !f64 {
result := x/y
if result.str().contains_any_substr([
return error(
}
return result
|