val randomNumber = Random().nextInt(3)

if (randomNumber is BigDecimal) {
    result = result.add(BigDecimal(36))
}

If you use type check, then 'result' is auto casting to BigDecimal type.

 

'as' keyword

val randomNumber = Random().nextInt(3)

if (randomNumber is BigDecimal) {
    result = result.add(BigDecimal(36))
} else {
    val tempResult: String = result as String
    result = tempResult.toUpperCase()
}