[C#]
// Consider changing this...
try {
result = 100 / num;
}
catch (Exception e) {
result = 0;
}
// ...to this.
if (num != 0)
result = 100 / num;
else
result = 0;
[Visual Basic]
' Consider changing this...
Try
result = 100 / num
Catch (e As Exception)
result = 0
End Try
// ...to this.If Not (num = 0)result = 100 / numElseresult = 0End If