let

data class Data( val value: Int?) 


fun getFromDatabase() : Data? { 
  ...
}


fun getValue() : BigDecimal { 
  return getFromDatabase()?.let { 
    it.toBigDecimal()
  } ?: BigDecimal.ZERO
}

Back Home Next