Scala Int <=(x: Int) 方法与示例
<=(x: Int)方法用于如果指定的第一个 int 值小于或等于第二个 int 值,则返回 true,否则返回 false。
Method Definition: (First_Int_Value).<=(Second_Int_Value)
Return Type: It returns true if the specified first int value is less than or equal to the second int value, otherwise returns false.
示例 #1:
// Scala program of Int <=(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int <=(x: Int) function
val result = (10).<=(100)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program of Int <=(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int <=(x: Int) function
val result = (500).<=(100)
// Displays output
println(result)
}
}
输出:
false
在评论中写代码?请使用 ide.geeksforgeeks.org,生成链接并在此处分享链接。