Scala Int | (x: Long) 方法及示例
|(x: Long) 方法用于返回 int 和指定的 long 值按位 OR 操作的结果值。
方法定义:(Int_Value).|(Long_Value)
返回类型:返回 int 和指定的 long 值按位 OR 操作的结果值。
示例#1:
// Scala program of Int |(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int |(x: Long) function
val result = (15).|(2)
// Displays output
println(result)
}
}
15
示例#2:
// Scala program of Int |(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int |(x: Long) function
val result = (13).|(9)
// Displays output
println(result)
}
}
13
阅读更多:Scala 教程
极客教程