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

后端 未结 3 1167
[愿得一人]
[愿得一人] 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 18:06

    This seems to work:

    if ( # Only do that when...
         ( $foo )-and   # foo AND
         ( $bar )       # bar
    )
     {Write-Host 'foobar'}
    

提交回复
热议问题