zoukankan      html  css  js  c++  java
  • pwershell switch 语句

    原文这里

      和其他语言的用法大体一致,一般用在多个条件下一个值得判定。

      需要注意的是powershell里使用注意:

    1. 可以通过 -wildcard -regex 来对要判断的值使用通配符或是正则表达式
    2. 可以对数组进行判定,遍历数组每一个值
    3. 跳出要使用break,否则会全部进行一次条件测试
    switch -wildcard ($a) 
        { 
            "?14150" {"The color is red."; break} 
            "?14151" {"The color is blue."; break} 
            "?14152" {"The color is green."; break} 
            "?14153" {"The color is yellow."; break} 
            "?14154" {"The color is orange."; break} 
            "?14155" {"The color is purple."; break} 
            "?14156" {"The color is pink."; break}
            "?14157" {"The color is brown."; break} 
            default {"The color could not be determined."}
  • 相关阅读:
    列表
    break和continue
    第三天下午
    第二天
    简历,面试
    周三 景安
    应届生求职优势(我的求职心…

    2013年01月02日
    Click and Drag
  • 原文地址:https://www.cnblogs.com/nervertoolate/p/7943684.html
Copyright © 2011-2022 走看看