Scala Float signum() method with example
Last Updated :
29 Oct, 2019
The signum() method is utilized to return 1 for positive specified number, -1 for negative specified number and 0 for 0 specified value.
Method Definition: (Value).signum
Return Type: It returns 1 for positive specified number, -1 for negative specified number and 0 for 0 specified value.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 5 ).signum
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = (- 5 ).signum
println(result)
}
}
|
Example #3:
object GfG
{
def main(args : Array[String])
{
val result = ( 0 ).signum
println(result)
}
}
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...