Single-expression function

When your function is doing nothing but simply evaluating the expression and returning a result, you can omit the curly braces. Look at how we are using it in multiple places:

    override fun getItemCount() = items.size
    fun buildScope(): Scope = Scope.build(Scope.R_BASICPROFILE,        Scope.R_EMAILADDRESS, Scope.W_SHARE)
    override fun getCount(): Int = 3 // Show 3 total pages.

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.