Android ● ● ● Kotlin 2.0

Kodebits Day 59: Reified Generics

Jul 17 2026
Practice reified with a short kotlin challenge.

What is the output?

inline fun <reified T>
  checkType(v: Any): Boolean {
  return v is T
}
fun main() {
  val r = checkType<String>("ok")
  println(r)
}


Try it in the online Kotlin Playground →

[spoiler title="Solution"]

Answer:

true

Explanation:

reified preserves type info at runtime in inline functions.

[/spoiler]


Further Reading