Scala Int <=(x: Byte)方法及其示例
< =(x: Byte)方法用于比较指定的int值和byte值,如果int小于或等于byte值,则返回true,否则返回false。
方法定义:(Int_Value).<=(Byte_Value)
返回类型:如果指定的int值小于或等于byte值,则返回true,否则返回false。
示例#1:
// Scala中的Int <=(x: Byte)方法
// 创建对象
object GfG
{
// 主方法
def main(args:Array[String])
{
//应用Int <=(x: Byte)函数
val result = (10).<=(100)
// 输出结果
println(result)
}
}
true
示例#2:
// Scala中的Int <=(x: Byte)方法
// 创建对象
object GfG
{
// 主方法
def main(args:Array[String])
{
//应用Int <=(x: Byte)函数
val result = (500).<=(100)
// 输出结果
println(result)
}
}
false
阅读更多:Scala 教程
极客教程