Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

However, the loop treats the iteration variable $value as local. So when it exits the list, $value regains the value it had before the loop. Since it was uninitialized before the loop, it therefore remains undefined afterwards, and the final print statement prints {{ is even}}.

Compliant Solution (Expanded Loop)

...

This compliant solution uses the non-iterative noniterative form of for, which does no localization of its iteration variable.

...