Cool how you can edit embed code …

data class Cat(val name: String, val age: Int=0) fun sum(a: Int, b: Int): Int { return a + b } fun main(args: Array<String>) { println(sum(2,3)) val cat = Cat("Kitty") println(cat.name) }

Here’s an example with tests. Note, you can edit and change this example

import org.junit.Test import org.junit.Assert data class Cat(val name: String, val age: Int=0) fun sum(a: Int, b: Int): Int { return a + b } class TestExtensionFunctions() { @Test fun testSum() { Assert.assertEquals(sum(2,5),7) } @Test fun testCat() { val cat = Cat("Sample Cat") Assert.assertEquals(cat.name, "Sample Cat") } }

Reference:

kotlin-playground/examples/