Scala Int %(x: Byte) 方法及示例
%(x: Byte) 方法用于返回特定整数值除以字节值时的余数。
方法定义: (Int_Value).%(Byte_Value)
返回类型: 返回特定整数值除以字节值时的余数。
示例 #1:
// Scala program of Int %(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int %(x: Byte) function
val result = (100).%(50)
// Displays output
println(result)
}
}
输出:
0
示例 #2:
// Scala program of Int %(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int %(x: Byte) function
val result = (100).%(40)
// Displays output
println(result)
}
}
输出:
20
阅读更多:Scala 教程
极客教程