is there a way to shorten repetitive math?

You could use a function to get rid of copy pasting code.

Example:

private string Calculate(float number) {
    return  ((((ATT * number) - EDEF) * 0.8M) + ((ATT * Pierce) - EDEF * ERES)).ToString();
}

Now you can call that function with:

R1S2NCtxt.Text = Calculate(R1S2);
R2S2NCtxt.Text = Calculate(R2S2);
R3S2NCtxt.Text = Calculate(R3S2);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top