本文主要是介绍【bug】“Attempted to divide by zero.”和“Index was outside the bounds of the array.”,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
bug
- “Attempted to divide by zero.”
- “Index was outside the bounds of the array.”
“Attempted to divide by zero.”
-
“System.DivideByZeroException:“Attempted to divide by zero.”
“试图除以零。”
出错地方:
因为我的i是从0开始的,所以就会出现n%0的情况,一个数除余0,即一个数除以0余几,而0不能被除,所以出错。
“Index was outside the bounds of the array.”
-
System.IndexOutOfRangeException:“Index was outside the bounds of the array.”
“索引超出了数组的界限。
出错地方:
因为不知道数组的长度,所以没有设长度,导致后续在数组里添加数值时产生了数组越界。
解决后:
💦更多内容请前往主页置顶或点击链接直达:【unity3D】游戏开发专栏的目录
这篇关于【bug】“Attempted to divide by zero.”和“Index was outside the bounds of the array.”的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!