Scala Char unary_+() method with example
Last Updated :
29 Oct, 2019
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#
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...