Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Scala Double +(x: Int) Method With Example

  • Last Updated : 03 Nov, 2019

The +(x: Int) method is used to find the sum of the specified double and the given ‘x’ type of int in the argument.

Syntax:def +(x: Int): Double
Returns: It return the sum of the specified double and the given int type ’x’.

Example 1:




// Scala program of +(x: Int) 
// method 
    
// Creating object 
object GfG 
{  
    
    // Main method 
    def main(args:Array[String]) 
    
        
        // Applying +(x: Int) method  
        val result = 5.39432456.+(32
            
        // Displays output 
        println(result) 
        
    
}  

Output:

37.39432456

Example 2:




// Scala program of +(x: Int) 
// method 
    
// Creating object 
object GfG 
{  
    
    // Main method 
    def main(args:Array[String]) 
    
        
        // Applying +(x: Int) method  
        val result = 5.39432456.+(78
            
        // Displays output 
        println(result) 
        
    
}  

Output:

83.39432456



My Personal Notes arrow_drop_up
Recommended Articles
Page :