Die Methode -(x: Double) wird verwendet, um die Differenz zwischen dem angegebenen Zeichenwert und 'x' vom Typ Double zu finden.

Methodendefinition: def -(x: Double): Double

Rückgabetyp: Es gibt Double zurück.

Beispiel 1#

// Scala program of -(x: Double)
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying -(x: Double) method 
        val result = 'A'.-(11.6574)
          
        // Displays output
        println(result)
      
    }
} 
Ausgabe:
53.3426

Beispiel: 2#

// Scala program of -(x: Double)
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying -(x: Double) method
        val result = 'D'.-(19.6578)
          
        // Displays output
        println(result)
      
    }
} 
Ausgabe:
48.3422