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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -