Look mum, no "if"s! (Solution Challenge 13)


#1

HI there,

after giving Objective C a try a year ago and stopped due to time, this time I want to get through the thing.

Here is my solution in a one liner:

[code]int main(int argc, const char * argv[])
{
@autoreleasepool {

	NSLog(@"Hey, it's %@ Time!", [[NSTimeZone systemTimeZone] isDaylightSavingTime] ? @"Summer" : @"Winter" );
}
return 0;

}
[/code]

My question: Is it okay, NOT to store the object pointer in a variable and just use it straight away in this case?

Best

iFlash


#2

You bet it is. If you don’t need the returned value to hang around, there’s no need to store it locally.