Caching loop variable