Pipeline and chain operators (|| and and&) now in pwsh

栏目: IT技术 · 发布时间: 6年前

内容简介: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 && cmd2 behaves like cmd1; if ($?) { cmd2 }
  • cmd1 || cmd2 behaves like cmd1; if (-not $?) { cmd2 }
  • cmd1 && cmd2 && cmd3 is 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 PSPipelineChainOperators experimental feature

PR Checklist


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

软件人才管理的艺术

软件人才管理的艺术

Michael Lopp / 罗小平 / 人民邮电出版社 / 201008 / 35.00元

本书作者具有15年的硅谷人才管理经验,他在博客上发表了大量探讨软件人才的管理之道的文章,深受读者欢迎。本书素材取自他的博客文章,用深入浅出的语言,讲述发人深思的道理,具有很强的现实操作性。 本书分为三大部分:“管理的箭袋”、“过程就是产品”、“你的其他版本”。前两部分分别讲述了人员与产品的管理,第三部分除了讨论管理之外,还讲述了如何有针对性地准备简历和电话面试,来提高自己面试成功的几率。书中......一起来看看 《软件人才管理的艺术》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具