Skip to content

Instantly share code, notes, and snippets.

@fomkin
Last active August 29, 2015 14:07
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 fomkin/fcb8045705554714d0f6 to your computer and use it in GitHub Desktop.
Save fomkin/fcb8045705554714d0f6 to your computer and use it in GitHub Desktop.
object Sum extends Application with MKML {
val a = Var("0")
val b = Var("0")
def start() = {
div(
input(`value` =:= a),
span(" + "),
input(`value` =:= b),
span(" = "),
span(
Bind {
try {
val sum = a().toInt + b().toInt
sum.toString
}
catch {
case _: NumberFormatException => "Enter a number"
}
}
)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment