Scala Long <(x: Int)-Methode
In Scala ist Long eine vorzeichenbehaftete 64-Bit-Ganzzahl, die dem primitiven Typ long von Java entspricht. Die Methode <(x: Int) wird verwendet, um wahr zurückzugeben, wenn dieser Wert kleiner als x ist, andernfalls falsch.
Methodendefinition – def <(x: Int): Boolesch
Rückgabe – Gibt „true“ zurück, wenn dieser Wert kleiner als x ist, andernfalls „false“.
Beispiel 1:
// Scala program to explain the working // of Long <(x: Int) method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying <(x: Int) function val result = (12.toLong).<(8:Int) // Displays output println(result) } }
Ausgabe:
falsch
Beispiel #2:
// Scala program to explain the working // of Long <(x: Int) method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying <(x: Int) function val result = (5.toLong).<(13:Int) // Displays output println(result) } }
Ausgabe:
wahr