The -(x: Char) method is utilized to find the difference of the stated character value and ‘x’ of type Char.
Method Definition: def -(x: Char): Int
Return Type:It returns Int.
Example: 1#
// Scala program of -(x: Char) // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying -(x: Char) method val result = 'D'.-('A') // Displays output println(result) } } |
chevron_right
filter_none
Output:
3
Example: 2#
// Scala program of -(x: Char) // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying -(x: Char) method val result = 'D'.-('\n') // Displays output println(result) } } |
chevron_right
filter_none
Output:
58
Recommended Posts:
- Scala Char to(end: Char, step: Char) method with example
- Scala Char |(x: Char) method with example
- Scala Char ^(x: Char) method with example
- Scala Char >=(x: Char) method with example
- Scala Char >(x: Char) method with example
- Scala Char ==(x: Char) method with example
- Scala Char <=(x: Char) method with example
- Scala Char !=(x: Char) method with example
- Scala Char %(x: Char) method with example
- Scala Char &(x: Char) method with example
- Scala Char *(x: Char) method with example
- Scala Char <(x: Char) method with example
- Scala Char /(x: Char) method with example
- Scala Char +(x: Char) method with example
- Scala Char to(end: Char) method with example
- Scala Int <(x: Char) method with example
- Scala Char isDigit() method with example
- Scala Char isLetter() method with example
- Scala Char isLetterOrDigit() method with example
- Scala Char toDouble() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

