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#
// Scala program of signum() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying signum() method
val result = ( 'F' ).signum
// Displays output
println(result)
}
} |
Output:
1
Example: 2#
// Scala program of signum() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying signum() method
val result = ( 'a' ).signum
// Displays output
println(result)
}
} |
Output:
1