programming_languages:scala

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programmiersprachen:scala [2017/02/19 15:35] phreazerprogramming_languages:scala [2017/02/19 15:46] (current) – ↷ Seite von programmiersprachen:scala nach programming_languages:scala verschoben phreazer
Line 23: Line 23:
 </code> </code>
  
-==== Control structures ====+===== Control structures =====
  
 if/else-Constructs have a return value if/else-Constructs have a return value
  
-=== for loop ===+==== for loop ====
 <code scala> <code scala>
 for (i <- 1 to 10) println(i) for (i <- 1 to 10) println(i)
Line 53: Line 53:
     println(result)     println(result)
 </code> </code>
-=== match ===+==== match ====
 Implizites break Implizites break
  
Line 64: Line 64:
 </code> </code>
  
-==== Singleton objects ====+===== Singleton objects =====
  
 There are no static methods/vars in scala and singleton objects can't be constructed using a constructor with new. There are no static methods/vars in scala and singleton objects can't be constructed using a constructor with new.
Line 78: Line 78:
 </code> </code>
  
-==== Companion object ====+===== Companion object =====
  
 Prerequisite: object and class have the same name and are defined in the same file. Companion objects can access their private variables. Singleton objects without companion clases are standalone objects. Prerequisite: object and class have the same name and are defined in the same file. Companion objects can access their private variables. Singleton objects without companion clases are standalone objects.
  
-==== Case classes ====+===== Case classes =====
  
   * Use a factory method for construction   * Use a factory method for construction
Line 95: Line 95:
 </code> </code>
  
-==== Inheritance ====+===== Inheritance =====
  
 Scala doesn't support multiple inheritance. Scala doesn't support multiple inheritance.
Line 106: Line 106:
  
  
-=== Abstract classes ===+==== Abstract classes ====
  
 Difference to Traits: Abstract classes can have constructors. A class which inherits from an abstract class can't inherit from another. Difference to Traits: Abstract classes can have constructors. A class which inherits from an abstract class can't inherit from another.
Line 112: Line 112:
 The usage of override is optional. The usage of override is optional.
  
-=== Packages object ===+==== Packages object ====
  
 Objects which are visible in a whole package. Objects which are visible in a whole package.
Line 118: Line 118:
  
  
-==== Identity and equality ====+===== Identity and equality =====
  
 ==-Operator checks equality (identity in Java) ==-Operator checks equality (identity in Java)
  • programming_languages/scala.1487514906.txt.gz
  • Last modified: 2017/02/19 15:35
  • by phreazer