Skip to content

Instantly share code, notes, and snippets.

@gyugyu90
Last active April 26, 2020 15:03
Show Gist options
  • Save gyugyu90/727f1d3aea613cdd840961d88ff99861 to your computer and use it in GitHub Desktop.
Save gyugyu90/727f1d3aea613cdd840961d88ff99861 to your computer and use it in GitHub Desktop.
fun main() {
val list = listOf("a", "b", "c")
if (-1 !in 0..list.lastIndex) {
println("-1은 범위 밖에 있네요")
}
if (list.size !in list.indices) {
println("리스트 사이즈가 인덱스 범위 밖에 있네요")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment