[ Swift ] 運算子 - 關係運算子

Imgur][Imgur

Download the source code from GitHub

[Comparison operator.playground]


關係運算子 (Comparison operator)

定義

比較兩個運算式的大小,其比較結果為 Bool 值

種類
  • <
    • operand1小於 operand2,則回傳 true,否則回傳 false
      Imgur
  • >
    • operand1大於 operand2,則回傳 true,否則回傳 false
      Imgur
  • <=
    • operand1小於等於 operand2,則回傳 true,否則回傳 false Imgur
  • >=
    • operand1大於等於 operand2,則回傳 true,否則回傳 false Imgur
  • ==
    • operand1 等於 operand2,則回傳 true,否則回傳 false Imgur
  • !=
    • operand1不等於 operand2,則回傳 true,否則回傳 false Imgur
  • ===

    • operand1 與operand2 參考到同一個實體,則回傳 true,否則回傳 false
  • !==

    • operand1 與operand2 不是參考到同一個實體,則回傳 true,否則回傳 false

Archer

Having being a full stack engineer. Experience with C, Python, Go, Swift, JavaScript, Node.js, LinkIt 7697, LinkIt Smart 7688, Raspberry Pi, ARM mbed, IoT solutions. Contact us : [email protected]

ALL RIGHTS RESERVED. COPYRIGHT © 2016. Designed and Coded by Makee.io