Hi there,

This is intentional. One of the issues with an expression-based language is that it is difficult to specify "early return" values in checking cut-out code at the start of a function. This syntax lets you do this without requiring further indentation for each case, e.g. consider this (fairly nonsensical... ) code:

let f x y =

if x < 0 then 0 else

let diff = y - x

if diff > 100 || y > 100 then 100 else

diff * 2

Here the "bodies of the "else" do align with the "if".

Kind regards

don

By on 4/23/2009 3:11 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper