8 Replies Latest reply on Apr 21, 2008 2:07 PM by kglad

    IF Statement

    WIDS-Chris Level 1
      Hello all, I know enough in AS to get by, but I find I end up doing things the long way and not the most efficient. can some one help. Heres the situation:

      I have a baseball site, I need the site to display the rankings of the teams purely on wins and losses. I currently have it setup to pull the scores from the database, and everytime a team wins it adds 1 to a gameWonVar (example: gameWonVar ++).

      So say:

      team1GameWonVar = 3 //Number of wins
      team2GameWonVar = 5 //Number of wins
      team3GameWonVar = 0 //Number of wins
      team4GameWonVar = 5 //Number of wins
      team5GameWonVar = 2 //Number of wins

      I know I can write about 100 IF Statements to determine who is in 1st, 2nd, 3rd ect... But is there a better way. I know I can check

      if (team1GameWonVar > team2GameWonVar ){
      if (team1GameWonVar > team3GameWonVar ){
      if (team1GameWonVar > team4GameWonVar ){
      if (team1GameWonVar > team5GameWonVar ){
      team1 = "First Place";


      but in order to check each team against each team, for each place, it would be a ton of coding and Im sure not even close to standard.
      Well if you got this far... Thanks for your help.