Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

switch multiple variables

Status
Not open for further replies.

csbdeady

Programmer
Joined
May 18, 2002
Messages
119
Location
GB
Hi there

Is it possible to perform switch - case with more than one variable, eg can:

if( $a == "a" or $b == "b" )
{
// something
}
elseif( $a == "x" or $b == "b" )
// something else
}

be changed into something like:

switch( $a, $b)
{
case "a", "b" :
// something
break;
case "x", "b" :
// something else
break;
}

or am I going to have to use nested switches?

Ta once again!
-Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top