type Foo =
class
inherit Bar
val _stuff : int
new (stuff : int) = {
inherit Bar()
_stuff = stuff
}
end
I want to add this code in above constructor:
if (stuff < 0) then raise (ArgumentOutOfRangeException "Stuff must be positive.")
else ()
How can I achieve this in F# ?
You can do this without needing any workarounds, but the placement of the initial left curly is fairly sensitive (or maybe the parser is buggy?). To do the effect first:
To do the effect second: