Last active
August 29, 2015 14:07
-
-
Save fomkin/fcb8045705554714d0f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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