Open In App

Scala Float self() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The self() method is utilized to return the same value which has been specified.

Method Definition: (Value).self

Return Type: It returns the same value which has been specified.

Example #1:




// Scala program of Float self()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying self method
        val result = (5.4).self
          
        // Displays output
        println(result)
      
    }
}  


Output:

5.4

Example #2:




// Scala program of Float self()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying self method
        val result = (5).self
          
        // Displays output
        println(result)
      
    }


Output:

5


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads