[thelist] if/else

Sam-I-Am sam at sam-i-am.com
Thu Nov 1 11:51:57 CST 2001


use switch?

or you can nest the ifs:
if(condition 1) { // do stuff}
else { 
  if(condition 2) { // do stuff }
  else {
    if(condition 3) { // do stuff }
    else { // every test failed.. }
  }
} 

hth
Sam    

Teck Low wrote:
> 
> How could I make 3 statements into if/else depending on p1 and p2? Only 1 of
> the 3 conditions will be true.
> 
> if(p1=1) { pagetxtnx=href+p1+'">Next</a>  '; };
> if(p1>1 && p1<p2)
>    pagetxtbk=href+(p1-2)+'">Back</a>  ';
>      pagetxtnx=href+(p1+2)+'">Next</a>  '; };
> if(p1=p2) { pagetxtbk=href+(p1-2)+'">Back</a>  '; };
>




More information about the thelist mailing list