How to split an “if” condition over multiline lines with comments

后端 未结 3 1256
[愿得一人]
[愿得一人] 2021-01-17 17:45

I cannot achieve to split an \"if\" condition over multiple lines in PowerShell WITH comments, see example:

If ( # Only do that when...
             


        
3条回答
  •  温柔的废话
    2021-01-17 17:55

    You can use block comments <# Your Comment #> to do this.

    If ( <# Only do that when... #> `
        $foo <# foo #> `
        -and $bar <# AND bar #> 
    )
    {
        Write-Host foobar
    }
    

提交回复
热议问题