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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multipe If statements... 1

Status
Not open for further replies.

rjonesX

Technical User
Jun 18, 2001
56
US
I have like 6 if statements to check at once..

Could I do something like

if($x==$y)($z>$a)($r==$b) {}
elseif...
else...

How else can I run check several equations at once...
 
CliveC
I recommend using "&&" in conditions, not "and". The two operators have different precedence, so using "and" in a condition can sometimes lead to strage bugs. That "sometime" happens very infrequently, but when it does, it is a very subtle thing to debug.

I know from experience. I spent a day-and-a-half debugging a code problem where I had used "and". Replacing it with "&&" fixed the problem.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top