On Thursday, 28 January 2021 at 18:53:51 UTC, Dennis wrote:
On Thursday, 28 January 2021 at 18:37:37 UTC, Ruby The Roobster
wrote:
object.Error@(0): Integer Divide by Zero
Why is this happening? Does anybody know?
data[0] = (new egg(0,0,"a"));
Here you set data[0].y to 0
tempb = data[x].y;
In the first iteration, this equals data[0].y which equals 0
temp = tempa / tempb;
And then you divide by zero here, hence the error
Okay. That worked. I added a check to set temp to zero if tempa
or tempb is zero.