Why am I getting a dividing by zero error message

Dennis dkorpel at gmail.com
Thu Jan 28 18:53:51 UTC 2021


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






More information about the Digitalmars-d-learn mailing list