Skip to content

Some convincing explanation #2

@hv0905

Description

@hv0905

File Content

PowerShell reads file line by line, which works like .NET 's File.ReadAllLine(). which means, the $myLetter is a string array.
And $myLetter.Contains("Hi"); only searches in the first child of the array.

Space after `

This is obvious. ` escape any character in pwsh. Without the space, pwsh will escape the LF, and will seize

$aAndB = $a `
    -and $b

as one expression.

But with the space, ` will escape the space instead of the LF. and will seize the codes as two expressions.
$aAndB = $a will set $aAndB to true
-and $b is invalid and will be ignored.

In powershell, theory and practice are combined: Nothing works and nobody knows why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions