f# - if requires an else clause -
i have following code in function, , eliminate duplication of dosomethingelse()
:
fun -> if = b let c = expensiveoperation() if c = d result else dosomethingelse() else dosomethingelse()
i think should able eliminate both else clauses. , let return either result
or dosomethingelse()
. when that, error message compiler is: "this expression expected have type unit here has type int "
why if
expression require else
clause?
this equivalent wrote, wonder if mean else.
if = b && expensiveoperation() = d result else dosomethingelse()
Comments
Post a Comment