带有示例的 Scala Short -(x: Float) 方法
-(x: Float)方法用于查找所述 Short 值与 Float 类型的“x”之间的差异。
Method Definition: def -(x: Float): Float
Return Type: It returns Float.
示例:1#
// Scala program of -(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying -(x: Float) method
val result = (1000).-(13.7)
// Displays output
println(result)
}
}
输出:
986.3
示例:2#
// Scala program of -(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying -(x: Float) method
val result = (-1000).-(17.9)
// Displays output
println(result)
}
}
输出:
-1017.9