Symbol#==():==() 是一個 Symbol 類方法,它比較兩個 Symbol 對象。
用法:Symbol.==()
參數:符號值
Return: 如果兩個 Symbol 相等則返回 true,否則返回 false
示例#1:
# Ruby code for Symbol.==() method
# declaring Symbol
a = :aBcDeF
# declaring Symbol
b = :"\u{e4 f6 fc}"
# declaring Symbol
c = :ABCDEF
# Symbol
puts "Symbol a : #{a}\n\n"
puts "Symbol b : #{b}\n\n"
puts "Symbol c : #{c}\n\n\n\n"
# == form
puts "Symbol a == form : #{a == c}\n\n"
puts "Symbol b == form : #{b == b}\n\n"
puts "Symbol c == form : #{c == a}\n\n"
輸出:
Symbol a : aBcDeF Symbol b : äöü Symbol c : ABCDEF Symbol a == form : false Symbol b == form : true Symbol c == form : false
示例#2:
# Ruby code for Symbol.==() method
# declaring Symbol
a = :geeks
# declaring Symbol
b = :"\u{e5 f6 f3}"
# declaring Symbol
c = :GEEKS
# Symbol
puts "Symbol a : #{a}\n\n"
puts "Symbol b : #{b}\n\n"
puts "Symbol c : #{c}\n\n\n\n"
# == form
puts "Symbol a == form : #{a == c}\n\n"
puts "Symbol b == form : #{b == b}\n\n"
puts "Symbol c == form : #{c == a}\n\n"
輸出:
Symbol a : geeks Symbol b : åöó Symbol c : GEEKS Symbol a == form : false Symbol b == form : true Symbol c == form : false
相關用法
- Scala Symbol ===用法及代碼示例
- Scala Symbol =~用法及代碼示例
- Scala Symbol.on用法及代碼示例
- Scala Symbol.orElse用法及代碼示例
- Scala Symbol.orElseBy用法及代碼示例
- Scala SymbolOrdering.on用法及代碼示例
- Scala SymbolOrdering.orElseBy用法及代碼示例
- Scala SymbolOrdering.orElse用法及代碼示例
- Scala SymbolModule.spliceOwner用法及代碼示例
- Scala SystemProperties.partitionMap用法及代碼示例
- Scala SystemProperties.unzip用法及代碼示例
- Scala SystemProperties.mkString用法及代碼示例
- Scala SystemProperties.groupMap用法及代碼示例
- Scala SystemProperties.sizeCompare用法及代碼示例
- Scala SystemProperties.inits用法及代碼示例
- Scala SystemProperties.addString用法及代碼示例
- Scala SystemProperties.scanRight用法及代碼示例
- Scala SystemProperties.elementWise用法及代碼示例
- Scala SystemProperties.runWith用法及代碼示例
- Scala SystemProperties.tails用法及代碼示例
- Scala SystemProperties.groupBy用法及代碼示例
- Scala SystemProperties.transpose用法及代碼示例
- Scala SystemProperties.equals用法及代碼示例
- Scala SystemProperties.sliding用法及代碼示例
- Scala SystemProperties.sizeIs用法及代碼示例
注:本文由純淨天空篩選整理自mayank5326大神的英文原創作品 Ruby | Symbol == function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。