Threshold limit finder

object Threshold {
    var value : Int = 0
    fun increment() {
    fun isAboveThreshold(limit: Int) : Boolean {
        if (value > limit)
            return false
            return true

fun main(args: Array<String>) {
    val thresholdLimit = 5
    for( value in 0..thresholdLimit + 1) {
        // Check whether the threshold is above the limit
        println("Is above the limit: ${Threshold.isAboveThreshold(value)}")

I’m having a problem getting this code to work. It should return true when a value is above a certain limit. Please could you help.

I’m not sure if I understand your code correctly. You seem to increment both the threshold and the limit with each iteration.