The +(x: Double) method is utilized to find the sum of the stated Short value and 'x' of type Double.
Scala
Scala
Method Definition: def +(x: Double): Double Return Type: It returns Double.Example: 1#
// Scala program of +(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Double) method
val result = (1000).+(10.4311)
// Displays output
println(result)
}
}
Output:
Example: 2#
1010.4311
// Scala program of +(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Double) method
val result = (-1000).+(54.1233)
// Displays output
println(result)
}
}
Output:
-945.8767