Scala Float unary_+ 方法与示例
unary_+方法用于返回已指定的相同浮点值。
Method Definition: (Float_Value).unary_+
Return Type: It returns the same float value which has been specified.
示例 #1:
// Scala program of Float unary_+
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying unary_+ function
val result = (65.0).unary_+
// Displays output
println(result)
}
}
输出:
65.0
示例 #2:
// Scala program of Float unary_+
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying unary_+ function
val result = (115.9).unary_+
// Displays output
println(result)
}
}
输出:
115.9