Related Articles

Related Articles

Scala Char signum() method with example
  • Last Updated : 03 Nov, 2019

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#

filter_none

edit
close

play_arrow

link
brightness_4
code

// 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)
      
    }

chevron_right


Output:

1

Example: 2#

filter_none

edit
close

play_arrow

link
brightness_4
code

// 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)
          
    }

chevron_right


Output:

1



My Personal Notes arrow_drop_up
Recommended Articles
Page :