jacodb icon indicating copy to clipboard operation
jacodb copied to clipboard

Wrong work with kotlin ranges

Open DaniilStepanov opened this issue 2 years ago • 0 comments

Example:

 fun isDigit(a: Int) : String {
        val aa = ArrayList<Int> ()
        aa.add(239)

        return when(a) {
            in aa -> "array list"
            in 0..9 -> "digit"
            !in 0..100 -> "not small"
            else -> "something"
        }
    }

    fun assertDigit(i: Int, expected: String): String {
        val result = isDigit(i)
        return if (result == expected) "" else "fail: isDigit($i) = \"$result\""
    }

    @JvmStatic
    fun box(): String {
        val result = assertDigit(0, "digit")
        if (result == "") return "OK"
        return result
    }

DaniilStepanov avatar Sep 07 '23 13:09 DaniilStepanov