PowerShell comparison operators

只愿长相守 提交于 2019-12-02 20:44:16

问题


PowerShell has a unique set of comparison operators: -eq -gt -lt -ne etc. I vaguely remember using such operators in a different language, but can't recollect which one.

Which other languages use such notations? what is reason for not using the standard operators (==, >,<, !=)?


回答1:


The Unix test command for instance uses similar operators. Perl has operators like that too, although without the leading hyphen.

The reason for PowerShell to use mnemnics rather than symbols for the comparison operators is probably that some of the commonly used comparison symbols are already in use for other operations (= → assignment, > → redirection).



来源:https://stackoverflow.com/questions/42206156/powershell-comparison-operators

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!