Newb question here.
Why would I do this:
NSPredicate *pred = [NSPredicate predicateWithFormat:@"(lineNum = %d)", i];
[request setPredicate:pred];
When I could just do this?
[request setPredicate:[NSPredicate predicateWithFormat:@"(lineNum = %d)", i]];
Every textbook code example I find uses the first method, but as far as I can see the second method will basically do the same thing and just looks neater. “pred” is only called once so why create it as an object?
This has to do primarily with the format of text books: it is hard to fit more than a certain number of characters on a page, because books have no scroll bars. Other than that, the two are identical.
One reason to do it in real life is so that you could set a break point and examine
predbefore callingsetPredicate:.