You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thanks! wrapping the values in parenthesis fixes the issue and you are correct the operator precedence is the issue: n := len(s)/ (1 + i) or flipping the values works n := len(s)/ 1+ i
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Division by 0 panic
What did you expect to see?
Expected: value at
iteration + 1
to evaluate to1 + iteration of range
and not a panic as if0
was the total value being divided byWorking version:
What did you see instead?
[Fatal panic:](panic: runtime error: integer divide by zero)
The text was updated successfully, but these errors were encountered: