Scala Char signum() method with example
The signum() method is utilized to return the Sign function of a Char value passed to it as an argument. If the argument passed is greater than zero, then it will return 1, if its equal to zero then it will return zero, and if its less than zero then it will return -1.
Method Definition: def signum: Int
Return Type: It returns integer.
Example: 1#
object GfG
{
def main(args : Array[String])
{
val result = ( 'F' ).signum
println(result)
}
}
|
Example: 2#
object GfG
{
def main(args : Array[String])
{
val result = ( 'a' ).signum
println(result)
}
}
|
Last Updated :
03 Nov, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...