Remove unused loop variable.
Avoid using a temporary variable by returning the value directly.
Merge pull request #4328 from abhinav-upadhyay/unused-variable

Remove unused loop variable.