Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Functon takes integers x and y with a return type of Int
- */
- fun multiply(x:Int,y:Int):Int{
- return x * y
- }
- /** No need or braces when only one statement is necessary**/
- fun add(x: Int, y: Int):Int = x + y
- /** Kotlin will know that return type is Int**/
- fun subtract(x: Int,y: Int) = x - y
- /*Find the max of a and b.
- * Note here that if construct is an epression in Kotlin(returns a value)
- * unlike in Java
- */
- fun max(a:Float,b:Float) = if(a>b) a else b
Add Comment
Please, Sign In to add comment