Open In App

Scala Char unary_+() method with example

Last Updated : 29 Oct, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The unary_+() method is utilized to convert a stated character into its value without any modification.
Method Definition: def unary_+: Int Return Type: It returns Integer value of the stated character.
Example: 1# Scala
// Scala program of unary_+()
// method

// Creating object
object GfG
{ 

    // Main method
    def main(args:Array[String])
    {
    
        // Applying unary_+ method
        val result = '9'.unary_+
        
        // Displays output
        println(result)
    
    }
} 
Output:
57
Example: 2# Scala
// Scala program of unary_+()
// method

// Creating object
object GfG
{ 

    // Main method
    def main(args:Array[String])
    {
    
        // Applying unary_+ method
        val result = 'A'.unary_+
        
        // Displays output
        println(result)
    
    }
} 
Output:
65

Next Article
Article Tags :

Similar Reads

  翻译: