Consider the following example:
if (cache) {
x = cache;
} else {
x = cache = someMethod();
}
Anyway to make this shorter than cache ? x = cache : x = cache = someMethod();?
EDIT:
Thanks for all the proposed solutions, I should have noted that the data in question is strings not booleans.
1 Answer