fun () -> // do something

is called an anonymous function.

In one line, you need to separate your instructions with ";".

let f = fun () -> printf "foo "; printf "bar"

In multiple lines, you can write (using #light):

let f = fun () ->
printf "foo "
printf "bar"

Does that answer your question?

Most anonymous functions fit in one line, but multiline anonymous functions sometimes happens. Of course, when it becomes really long, I suggest you to use a normal function.

Laurent.

By on 4/10/2007 1:36 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