The reason why I wrote the snippet above is exactly readability. I had to go through your test several times to understand what it does.
Saving values to just use them once is not good as it wastes your short-term memory. People generally cannot hold more than 5 items in direct focus at the same time.