It's great that Kotlin got rid of the semicolon at the end of each line, but why are there still braces? Given that we already use an IDE that indents the code to match the braces, why not get rid of the braces entirely and use the indentation for that directly? Many languages already do this and it works well. Code could look like this: package bottles
fun main(args: Array<String>)
if (args.isEmpty)
printBottles(99)
else
try
printBottles(Integer.parseInt(args[0]))
catch (e: NumberFormatException)
System.err.println("You have passed ‘${args[0]}’ as a number of bottles, " +
“but it is not a valid integer number”)
fun printBottles(bottleCount: Int)
if (bottleCount <= 0)
println(“No bottles - no song”)
return
println(“The ‘${bottlesOfBeer(bottleCount)}’ songn”)
bottles := bottleCount
while (bottles > 0)
bottlesOfBeer := bottlesOfBeer(bottles)
print(“$bottlesOfBeer on the wall, $bottlesOfBeer.nTake one down, pass it around, “)
bottles–
println(”${bottlesOfBeer(bottles)} on the wall.n”)
println(“No more bottles of beer on the wall, no more bottles of beer.n” +
“Go to the store and buy some more, ${bottlesOfBeer(bottleCount)} on the wall.”)
fun bottlesOfBeer(count: Int): String
“${when (count)
0 -> “no more bottles”
1 -> “1 bottle”
else -> “$count bottles”} of beer”
///
An excerpt from the Standard Library
///
// This is an extension property, i.e. a property that is defined for the
// type Array<T>, but does not sit inside the class Array
<T> Array<T>.isEmpty: Boolean get() := size() == 0