For some reason the % alias for ForEach-Object throws an exception when using the ( $Thing in $Things) syntax while the ForEach alias works fine.
Here are two examples:
Using the % alias:
$ints = @(1, 2, 3, 4, 5)
% ($i in $ints)
{Write-Host $i}
This fails with the error Unexpected token 'in' in expression or statment.
Using the ForEach alias:
$ints = @(1, 2, 3, 4, 5)
foreach ($i in $ints)
{Write-Host $i}
This succeeds without issue.
Why is there a difference if they are both aliases of ForEach-Object?