This is my code for checking if two NSDate objects have a values, the problem though is this structure is not working, I tried changing the if statements to for example oldDate == nil, but that also doesn’t work. Any thoughts?
if (!oldDate && !newDate) {
NSLog(@"oldDate & newDate are empty");
}
else {
NSLog(@"oldDate & newDate have values");
}
if (!oldDate) {
NSLog(@"oldDate is empty but newDate has a value");
}
else if (!newDate) {
NSLog(@"newDate is empty but oldDate has a value");
}
You have two if/else blocks which get executed. But you want to have only one: