package iii_conventions

import util.TODO


class Invokable(var numberInvocations: Int = 0) {

    operator fun invoke(): Invokable {
        numberInvocations++
        return this
    }

    fun getNumberOfInvocations() = numberInvocations
}

fun todoTask31(): Nothing = TODO(
    """
        Task 31.
        Change class Invokable to count the number of invocations (round brackets).
        Uncomment the commented code - it should return 4.
    """,
    references = { invokable: Invokable -> })

fun task31(invokable: Invokable): Int {
//    todoTask31()
    return invokable()()()().getNumberOfInvocations()
}

package iii_conventions

import util.TODO


class Invokable(private var nInvocations: Int = 0) {

    operator fun invoke(): Invokable {
        nInvocations++
        return this
    }

    fun getNumberOfInvocations() = nInvocations
}

fun todoTask31(): Nothing = TODO(
    """
        Task 31.
        Change class Invokable to count the number of invocations (round brackets).
        Uncomment the commented code - it should return 4.
    """,
    references = { invokable: Invokable -> })

fun task31(invokable: Invokable): Int {
//    todoTask31()
    return invokable()()()().getNumberOfInvocations()
}

Make var private, smaller scope
Make var private, smaller scope

rpandey1234/kotlin-koans,rpandey1234/kotlin-koans