Home > Back-end >  If the else optimization problem
If the else optimization problem

Time:10-22

Zhixing (int su1, int su2) running in the timer function, how to optimize, hope to have a sample, thank you!!!!!
Int bz=0; Int ban=0; Int huan=0;
Void zhixing (int su1, int su2)
{
If (bz==1)
(aa);
Else if (bz==2)
Bb ();
Else if (bz==3)
Cc ();
Else if (bz==4)
Dd ();
Else if (bz==5)
Ee ();
.
}

//bb (); Cc (); Dd (); Ee (); Like aa (), its small paragraph order immutable
Void (aa)
{
If (ban==1)
{
//associated with other paragraphs without any immutable
,,,,,,,,
}
Else if (huan==1)
{
//associated with other paragraphs without any immutable
,,,,,,,,
}
Else if (ban==2)
{
//associated with other paragraphs without any immutable
,,,,,,,,
}
Else if (ban==3)
{
//associated with other paragraphs without any immutable
,,,,,,,,
}
Else if (ban==4)
{
//associated with other paragraphs without any immutable
,,,,,,,,
}
.
}

CodePudding user response:

Your so-called optimization to point to? The aa, bb, cc, dd, ee merger? Or remove the if else statements? These if else branch condition is different, you must be needed,
  • Related