<@U2H3SABQF> My suggestion would be to introduce m...
# getting-started
p
@elect My suggestion would be to introduce method (maybe extension metod on the type of
it
?). Then it would look like (assuming that
it
is of type
Something
):
Copy code
val animName = readAttribute(it, "name")
        ?: readAttribute(it, "id")
        ?: "animation_${mAnimationClipLibrary.size}”
where for example:
Copy code
fun readAttribute(something: Something, attributeName: String): String? =
        when (something.hasAttribute(attributeName)) {
            true -> something.getAttribute(attributeName)
            false -> null
        }
👍 1