BAEL-382 more examples

This commit is contained in:
Tomasz Lelek 2017-01-17 15:44:28 +01:00
parent 9512edb667
commit 2c0b55e4a3
1 changed files with 12 additions and 5 deletions

View File

@ -26,25 +26,32 @@ class ItemManager(val categoryId: String, val dbConnection: String) {
println(result)
}
fun sum(a: Int, b: Int): Int {
return a + b
}
}
fun main(args: Array<String>) {
val numbers = arrayOf("first", "second", "third", "fourth")
var concat = ""
for (n in numbers) {
concat += n
println(n)
}
var sum = 0
for (i in 2..9) {
sum += i
for (i in 2..9 step 2) {
println(i)
}
val res = 1.rangeTo(10).map { it * 2 }
println(res)
val firstName = "Tom"
val secondName = "Mary"
val concatOfNames = "$firstName + $secondName"
println("Names: $concatOfNames")
val sum = "four: ${2 + 2}"
val itemManager = ItemManager("cat_id", "db://connection")
val result = "function result: ${itemManager.isFromSpecificCategory("1")}"