Skip to content

Instantly share code, notes, and snippets.

@timohirt
Created October 8, 2013 21:58
Show Gist options
  • Save timohirt/6892513 to your computer and use it in GitHub Desktop.
Save timohirt/6892513 to your computer and use it in GitHub Desktop.
println("Hello World")
// Vars / static types
var v1: String = "Test"
v1 = "Test 2"
//v1 = 2 -> Fehler, da va bereits Type String
// Type inference
var v2 = "Variable 2"
//v2 = 34 -> Fehler, da Type inference den Type String für v2 erkannt hat.
// Vals
val v3 = 234
//v3 = 23444 -> Vals sind immutable
// Everything is an object
val one = 1
val five = 5
// no build-in operators
one + five
one.+(five)
// Scala Strings, format strings
s"Dies ist eine ${one}"
import java.sql.{Date => SQLDate}
new SQLDate(System.currentTimeMillis())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment