I don't think they will ever added and there are not considered for adding. "continue" and "break" don't fit in the language at all. In F# everything is an expression, statements doesn't exists.

Even a "for" loop is just an expression that either returns "unit" or the last value when you use "->" instead of "do", or you use "yield".

But "continue" and "break" are pure statements. They not return anything, they change which code should be executed next. We also cannot just build "continue" and "break" that they return "unit". As this wouldn't change anything. I don't think "continue" and "break" will ever be included or up for discussion, as they break the fundamental rule that everything is an expression.

Probably if you really want looping with those keywords then you could build something like a looping Computation Expression. I slightly remember that i have seen something like that before, but cannot remember any concrete example.

EDIT:
I blogged about a "foldk" function that gives this ability of "continue" or "break":
[link:sidburn.github.io]

By on 4/27/2016 11:06 AM ()

I agree with Gustavo. Those sentences are helpful for reducing code complexity and keeping identation levels low.

By on 8/5/2014 9:47 AM ()

If you need break and continue, you are probably going against the grain. I would recommend reading how other people are using the language.

By on 12/24/2016 8:21 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper