Skip to content

Wrong work with kotlin ranges #175

Open
@DaniilStepanov

Description

@DaniilStepanov

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
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingir

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions