Posted by Jerry Stuckle on 11/01/06 12:57
Sonnich wrote:
> this is probably an old topic:
>
> if(a==1)
> if(b==2)
> echo "a is 1 and b is 2";
> else
> // what happens here?
> echo "a is 1 and b is not 2";
>
> The question is, where the else will react too. Usually it should be
> the last if.
>
> In general I put {} around just to be sure.
>
> BR
> Sonnich
>
'else' clauses are always matched with the first unpaired 'if' preceding
them.
Using braces does make things clearer, though.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|