logo
  • 教程列表
  • SO官方文檔
  • 布林
    • 布林和內聯條件
    • 什麼是布林
    • 使用字首運算子否定 Bool
    • 布林邏輯運算子
  1. StackOverflow 文件
  2. Swift Language 教程
  3. 布林
  4. 使用字首運算子否定 Bool

使用字首運算子否定 Bool

Created: November-22, 2018

該字首 ! 操作返回邏輯否定其說法。也就是說,!true 返回 false,!false 返回 true。

print(!true)  // prints "false"
print(!false) // prints "true"

func test(_ someBoolean: Bool) {
    if !someBoolean {
        print("someBoolean is false")
    }
}
  • 布林邏輯運算子
  • 什麼是布林

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明