内容简介:This PR is specified byImplements
This PR is specified by PowerShell/PowerShell-RFC#192
PR Summary
Resolves #3241 .
Implements &&
and ||
.
A statement like cmd1 && cmd2
should behave like cmd1; if ($?) { cmd2 }
.
After discussion with the @PowerShell/powershell-committee , this feature has the following charateristics:
-
cmd1 && cmd2behaves likecmd1; if ($?) { cmd2 } -
cmd1 || cmd2behaves likecmd1; if (-not $?) { cmd2 } -
cmd1 && cmd2 && cmd3is left associative:[cmd1 && cmd2] && cmd3 -
No control flow statements in pipeline chains; only pipelines
. Control flow statements are still possible with subexpressions in pipelines (
cmd1 && $(break)). These were taken out due to the inconsitencies they posed at a grammatical, data structure and semantic level. - Assignment is consistent with other assignment in PowerShell, so that a script terminating error will not result in a partial assignment, but a pipeline-terminating error will.
-
This syntax is available as the
PSPipelineChainOperatorsexperimental feature
PR Checklist
-
PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
-
Make sure all
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header -
This PR is ready to merge and is not Work in Progress
.
-
If the PR is work in progress, please add the prefix
WIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.
-
If the PR is work in progress, please add the prefix
-
Breaking changes
- None
- OR
-
Experimental feature(s) needed
-
Experimental feature name(s):
-
Experimental feature name(s):
-
User-facing changes
- Not Applicable
- OR
-
Documentation needed
- Issue filed: MicrosoftDocs/PowerShell-Docs#4853
-
Testing - New and feature
- N/A or can only be tested interactively
- OR
- Make sure you've added a new test if existing tests do not effectively test the code changed
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
计算机程序设计艺术(第2卷)
高德纳 / 机械工业出版社 / 2008-1 / 109.00元
《计算机程序设计艺术:半数值算法(第2卷)(英文版)(第3版)》主要内容:关于算法分析的这多卷论著已经长期被公认为经典计算机科学的定义性描述。迄今已出版的完整的三卷已经组成了程序设计理论和实践的惟一的珍贵资源,无数读者都赞扬Knuth的著作对个人的深远影响,科学家们为他的分析的美丽和优雅所惊叹,而从事实践的程序员已经成功地将他的“菜谱式”的解应用到日常问题上,所有人都由于Knuth在书中表现出的博......一起来看看 《计算机程序设计艺术(第2卷)》 这本书的介绍吧!