Scala short <(x: Byte): Boolean

Scala short <(x: Byte): Boolean

Short(16位的有符号整数,相当于Java的short原始类型)是scala.AnyVal的子类型。<(x: Byte)方法用于返回true如果此值小于x,否则返回false。

方法定义:def <(x: Byte): Boolean

返回类型:如果此值小于x则返回true,否则返回false。

例子#1:

// Scala program of Short <(x: Byte) 
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Short <(x: Byte) function 
        val result = (998.toShort).<(11:Byte)
          
        // Displays output 
        println(result) 
      
    } 
} 

输出:

False

例子#2:

// Scala program of Short <(x: Byte) 
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Short <(x: Byte) function 
        val result = (102.toShort).<(101:Byte)
          
        // Displays output 
        println(result) 
      
    } 
} 

输出:

false

阅读更多:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程