Skip to content

Add Gotcha :: Breaking from the pipeline #138

Description

@JohnLBevan

It would be good to add a gotcha on breaking from pipelines...

i.e. People expect this:

    $found = $false
    $list | ForEach-Object {
        if ($_ -eq $searchFor) {
            $found = $true
            break
        }
    }
    if ($found){'Woo'}else{'Boo'}

to work like this:

    $found = $false
    foreach {$item in $list} {
        if ($item -eq $searchFor) {
            $found = $true
            break
        }
    }
    if ($found){'Woo'}else{'Boo'}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions