Skip to content

Instantly share code, notes, and snippets.

@jamescrosswell
Created October 7, 2014 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescrosswell/046b84d86cc698cd3ac5 to your computer and use it in GitHub Desktop.
Save jamescrosswell/046b84d86cc698cd3ac5 to your computer and use it in GitHub Desktop.
package myApp
object MyApp {
def main(args: Array[String]): Unit = {
val greeter = new Greeter()
greeter.Greet
}
}
class Greeter(name: String){
require(name != null && !name.isEmpty, "You gotta say hi to someone!")
def this() = {
this("world")
println("Warning: you're addressing the room!")
}
def Greet() = { println("Hello %s".format(name)) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment