Skip to content

Instantly share code, notes, and snippets.

@fernandezpablo85
Created October 22, 2011 23:20
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 fernandezpablo85/1306619 to your computer and use it in GitHub Desktop.
Save fernandezpablo85/1306619 to your computer and use it in GitHub Desktop.
class Ternary (condition : Boolean)
{
def options (good: String, bad: String) = if (condition) good else bad
}
val loggedIn = true
val message = new Ternary(loggedIn).options("Welcome", "Please log in first")
println(message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment