RosettaCodeData/Task/Detect-division-by-zero/Sidef/detect-division-by-zero-1.s...

8 lines
150 B
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

func div_check(a, b){
var result = a/b
result.abs == Inf ? nil : result
}
 
say div_check(10, 2) # 5
say div_check(1, 0) # nil (detected)