给定的片段由方法调用组成,它们返回一个选项类型。如果上一个调用返回 None,我想调用下一个方法。我可以用这个片段来完成这个
def amountToPay : Option[TextBoxExtraction] =
getMaxByFontsize(keywordAmountsWithCurrency) match {
case None => getMaxByFontsize(keywordAmounts) match {
case None => highestKeywordAmount match {
case None => getMaxByFontsize(amountsWithCurrency) match {
case None => highestAmount
case some => some
}
case some => some
}
case some => some
}
case some => some
}
但它看起来很乱。所以我希望有更好的方法来做到这一点。