That's precisely the kind of conditional I'm curious about -- I want to be able to change display output based on conditions, but after watching the memory footprint of this app get larger and larger, I want to do it in the most computationally efficient manner.
Is the following code (assume it's all inside a single function and variable zap isn't static or persistent:
Code:
int zap = (calculationToGetZap(parameter) );
if (zap > 50) {
doBigThing();
}
else if (zap > 100) {
doBiggerThing();
}
else {
doTinyThing();
}
the same (in terms of memory allocation and other resource efficiency) as this:
Code:
if ((calculationToGetZap(parameter) > 50) {
doBigThing();
}
else if ((calculationToGetZap(parameter) > 100) {
doBiggerThing();
}
else {
doTinyThing();
}