Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Float floor() method with example

  • Last Updated : 29 Oct, 2019

The floor() method is utilized to returns a float number which is less than or equal to the given float number.

Method Definition: (Float_Number).floor

Return Type: It returns a float number which is less than or equal to the given float number.

Example #1:




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

Example #2:




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



My Personal Notes arrow_drop_up
Recommended Articles
Page :