Or just replace the "||" with "&&".  DeMorgan's theorem.   Basic boolean
logic.


On 2/13/09 3:19 AM, "cocoa-dev-requ...@lists.apple.com"
<cocoa-dev-requ...@lists.apple.com> wrote:

> Subject: Re: isNotEqualToString
> To: Chunk 1978 <chunk1...@gmail.com>
> Cc: cocoa-dev Dev <cocoa-dev@lists.apple.com>
> Message-ID: <bce6072a-93f8-4c71-985d-e9714fbad...@agfa.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
> 
> 
> On 13 Feb 2009, at 10:00, Chunk 1978 wrote:
> 
>> -=-=-=-
>> if ((![currentDesktopBackgroundImage isEqualToString:firstPath]) ||
>> (![currentDesktopBackgroundImage isEqualToString:secondPath]))
>> {
>> //Go South
>> }
> 
> lets assume that currentDesktopBackgroundImage IS firstPath (and that
> secondPath ≠ firstPath)
> 
> The first portion of your test gives false so it tries the second
> portion.
> This gives true, since currentDesktopBackgroundImage ≠ secondPath
> 
> so you go south. Your version will always Go South UNLESS
> currentDesktopBackgroundImage == firstPath == secondPath
> 
> I think you want this;
> 
> if (!([currentDesktopBackgroundImage isEqualToString:firstPath] ||
> [currentDesktopBackgroundImage isEqualToString:secondPath]))
> {
> //Go South
> }
> 
> Matt
> 
> ------------------------------

G. Apple



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to