yet more scala
This commit is contained in:
parent
f4f448926d
commit
92f8b24f6a
13
scala-tutorial/FrenchDate.scala
Normal file
13
scala-tutorial/FrenchDate.scala
Normal file
@ -0,0 +1,13 @@
|
||||
import java.util.{Date, Locale}
|
||||
import java.text.DateFormat
|
||||
import java.text.DateFormat._
|
||||
|
||||
object FrenchDate {
|
||||
def main(args: Array[String]) {
|
||||
val now = new Date
|
||||
val df = getDateInstance(LONG, Locale.FRANCE)
|
||||
println(df format now)
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=4 sw=4 et:
|
15
scala-tutorial/Timer.scala
Normal file
15
scala-tutorial/Timer.scala
Normal file
@ -0,0 +1,15 @@
|
||||
object Timer {
|
||||
def oncePerSecond(callback: () => Unit) {
|
||||
while (true) { callback(); Thread sleep 1000 }
|
||||
}
|
||||
|
||||
def timeFlies() {
|
||||
println("time flies like an arrow...")
|
||||
}
|
||||
|
||||
def main(args: Array[String]) {
|
||||
oncePerSecond(timeFlies)
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=4 sw=4 et:
|
Loading…
Reference in New Issue
Block a user