Skip to content

Add Gotcha :: Breaking from the pipeline #138

Open
@JohnLBevan

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'}

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