What should be added to C

MKR mkr at mmm.UUCP
Sat Jun 7 01:39:27 AEST 1986


In article <3542 at reed.UUCP> kab at reed.UUCP (Kent Black) writes:
>In article <1497 at mmintl.UUCP> franka at mmintl.UUCP (Frank Adams) writes:
>>>> o An andif clause for if statements.
>>You would write:
>>  if (A) {
>>    X
>>  } andif (B) {
>>    Y
>>  } else {
>>    Z
>>  }
>
>Which is equivalent to: 
>
>	if (A)	{
>	    X;
>	    if (B) 	{
>	    	Y;
>	    }
>	} else	{
>	    Z;
>	}
>	
	Correct me if I'm wrong ( :-) ), but the second example is not 
actually equivalent to the first. In the first I assume that Frank means
that Z gets executed only if A *and* B are false. In the second, Z gets
executed if A is false, regardless of B.


--MKR



More information about the Comp.lang.c mailing list