"You must learn from the mistakes of others. You can't possibly live long enough to make them all yourself"
Sam Levenson
Pacman ifs   -7 Votes
Posted 2 years, 7 months ago
  1:  if (cond1) {
  2:      /* Something */
  3:  } else if (cond2) {
  4:          /* Something else */
  5:      } else if (cond3) {
  6:              /* Something else, again */
  7:          } else if (cond4) {
  8:                  /* Something else, again */
  9:              } else if (cond5) {
 10:                      /* Something else, again */
 11:                  } else if (cond6) {
 12:                          /* Something else, again */
 13:                      } else if (cond7) {
 14:                              /* Something else, again */
 15:                          } else if (cond8) {
 16:                                  /* Something else, again */
 17:                              } else if (cond9) {
 18:                                      /* Something else, again */
 19:                                  } else if (cond10) {
 20:                                          /* Something else, again */
 21:                                      } else if (cond11) {
 22:                                              /* Something else, again */
 23:                                          } else if (cond12) {
 24:                                                  /* Something else, again */
 25:                                              } else if (cond13) {
 26:                                                      /* Something else, again */
 27:                                                  } else if (cond14) {
 28:                                                          /* Something else, again */
 29:                                                      } else if (cond15) {
 30:                                                              /* Something else, again */
 31:                                                          } else if (cond16) {
 32:                                                                  /* Something else, again */
 33:                                                              } else {
 34:                                                                  /* And goes on... */
 35:                                                              }
Bookmark and Share
From Camron
Posted 10 months, 4 weeks ago
The way you handle this is with a state-machine design...
From Anonymous
Posted 1 year, 8 months ago
whats wrong in it...
do u have other way to do it....
then post it :)
From Anonymous
Posted 1 year, 8 months ago
This is really bad prgogramming, this is awfull !
Add a comment
Name