Function calls vs. local variables
I often see functions where other functions are called multiple times instead of storing the result of the function once. i.e (1) : void ExampleFunction() { if (TestFunction() > x || TestFunction() < y || TestFunction() == z) { a = TestFunction(); return; } b = TestFunction(); } Instead I would write it that way, (2) : void ExampleFunction() { int test = TestFunction(); if (test > x || test < y || test == z) { a = test; return; } b = test; } I think version 2 is much better to read and better to debug. But I'm wondering why people do it like in number 1? Is there anything I don't see?