Scala Char unary_-() method with example
Last Updated :
29 Oct, 2019
The unary_-() method is utilized to give the negation value of the stated character.
Method Definition: def unary_-: Int
Return Type: It returns negative Integer value of the stated character.
Example: 1#
object GfG
{
def main(args : Array[String])
{
val result = '9' .unary _ -
println(result)
}
}
|
Example: 2#
object GfG
{
def main(args : Array[String])
{
val result = 'A' .unary _ -
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...