【问题标题】:Negation operation in TCLTCL中的否定操作
【发布时间】:2017-01-23 18:34:37
【问题描述】:

我还没有设法找出如何在 TCL 中否定布尔值... 我试过了:

set x true
puts !$x   #prints '!true'
puts ![$x] #prints !
puts [!$x] #prints no event matches "true"
puts !{$x} #prints !{true}
puts {!$x} #prints !$x

【问题讨论】:

    标签: boolean tcl negation


    【解决方案1】:

    逻辑“非”是算术运算符,所以需要expr

    % set x true
    true
    % puts [expr {!$x}]
    0
    % puts [expr {!!$x}]
    1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-15
      • 1970-01-01
      • 1970-01-01
      • 2015-12-03
      • 1970-01-01
      相关资源
      最近更新 更多