Talk:Appearance rates

From Kolmafia
Jump to navigation Jump to search

StDoodle, regarding our recent discussion regarding the switch statement: How's this for a nice use of it to increase code readability? Incidentally, there was a bug in the original code -- it didn't pick out bosses. --Bale 05:00, 6 May 2010 (UTC)

It still doesn't clarify that one can use completely "unrelated" variables in the individual case statements. Ie, you could do the following (if I'm not mistaken):

int a;
//stuff may happen to a
boolean [string] blah;
//blah may get populated
foreach x in blah {
   switch {
      case x == "hello":
         print("kitty");
         break;
      case a > 9000:
         print("spare me the memes");
         break;
      //etc.
   }
}

--StDoodle (#1059825) 15:58, 6 May 2010 (UTC)

No? I tested for mob == $monster[none] and I tested for freq > 0. Those are different variables. --Bale 21:27, 6 May 2010 (UTC)