[PS] foreach keyword alias

Discussion in 'Scripting' started by Mark Ayers, May 17, 2006.

  1. Mark Ayers

    Mark Ayers Guest

    foreach is refered to as a keyword in some places while it is an alias to
    ForEach-Object. Does it matter?
    Mark Ayers, May 17, 2006
    1. Advertisements

  2. Mark,

    I'm not aware of a situation which is ambiguous.

    Foreach, as a keyword, occurs at the beginning of a statement.

    Foreach, as an alias for foreach-object, occurs in the second or later
    step of a pipeline.

    Andrew Watt MVP
    Andrew Watt [MVP], May 18, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.