Re: BOOL value in Dictionary
Re: BOOL value in Dictionary
- Subject: Re: BOOL value in Dictionary
- From: Heinrich Giesen <email@hidden>
- Date: Fri, 21 Nov 2008 16:42:33 +0100
Hi,
besides what Ken Thomases and Graham Cox already said, I have a
remark concerning programming style:
if ( colorSwitch == YES) {
[colorBox setState:NSOnState];
}
else {
[colorBox setState:NSOffState];
}
It is bad to test a Boolean value with "colorSwitch==NO" and it is a
very very bad habit to test
a Boolean value with "== YES" (there is a longer thread in this
forum). It is not that difficult to
smoothly deal with Boolean expressions. It's not a question of
efficiency but a question of style,
so the above snippet is equivalent (and more Boolean-like):
[colorBox setState: colorSwitch ? NSOnState : NSOffState];
Heinrich
--
Heinrich Giesen
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden