Since I need j%3 and j%5 to use in three places, I used it like a variable, I just want to know, is this reduce any memory storage and increase efficiency,
private void forloo()
{
bool a = j % 3 == 0;
bool b = j % 5 == 0;
for (int i=0; i < j; i++)
{
if (a&&b)
{
richTextBox1.Text += "Hop\n";
}
if (a)
{
richTextBox1.Text += "Hoppity\n";
}
else if (b)
{
richTextBox1.Text += "HopHop\n";
}
}
}
+=on two strings (as opposed to using aStringBuidler) rather than an arithmetic-boolean equality. I would say the difference in performance is near none.