how do you handle more then two if conditions

what is the best way to handle three conditions? for example if i have three flags
bNormal
bSearchMode
bBrowsingMode

so one can be true and others false. i am not that good of a programmer, i can handle this but what is the
best practice and most minimal code?

thanks!

use a switch statment
http://msdn.microsoft.com/en-us/library/06tc147t(VS.80).aspx

It really depends on what conditions you want to test for. A switch statement is good when you have a single variable that can have one of several different values, but not so useful when you have several different variables to test. In this case, you might want an ‘if/else if/else’ type structure, or an ‘if’ with several conditions combined through ‘c1 c2 / c1 || c2’ logical operators.

For mutually-exclusive conditions, an enum + switch is better than “a bunch of booleans only one of which can be true”

enum Mode {
  Normal, Search, Browsing
}
var mode : Mode;

// ... blah ...
switch ( mode ) {
  case Mode.Normal :
    // handle it
    break;
  case Mode.Search :
    // handle it
    break;
  etc.
}

But if your booleans aren’t mutually exclusive, laurie’s got the right answer for you - use and || in the right combinations, or a bunch of if/elses.