Daniel
05/22/2017, 11:46 AMwhen expression readability wise (more specific if it improves the readability in one line functions with branching)
fun calculatePartWidth(part: Draft) = when(part) { sign -> maxWidth else -> defaultWidth }
fun calculatePartWidth(part: Draft) = if(part == sign) maxWidth else defaultWidth
Which of those would you prefer? My personal opinion is that the when saves one from doing a refactoring there, which would be along the lines of:
if(isASign(part)) maxWidth else defaultWidth