Just wondering - given that I have a typedef enum 'color' (and property of the same name) with a valid element 'blue', why is this ok:
BOOL isBlue;
if (color == blue){
isBlue = YES;
}
but this is not:
BOOL isBlue;
isBlue = (color == blue);
I've just started using enums so maybe i'm missing something simple?
Edit - as mentioned 'blue' is one of the valid elements of the enum, not a BOOL itself, i.e:
typedef enum { Blue, Red, Yellow } color;
and
@property color color;
Edit 2 - here's my actual code, as requested. I'm a bit confused by the contradictory comments/answers. Should I expect this to compile (it doesn't)?
.h
typedef enum { AddRecipes, ManageRecipes, RemoveRecipes } mode;
<snip>
@property mode mode;
.m
@synthesize mode;
<snip>
BOOL modeIsAddRecipe = (mode == AddRecipes);
Edit 3 - for posterity I should mention that my error was trivial and unrelated. The discussion below proved enlightening though, many thanks.