Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# forwarding of optional parameter

Tags:

f#

Is it possible to forward optional parameters e.g:

type Type() =
    member this.A(?param) = printfn "%d" <| defaultArg param 0
    member this.B(?param) = this.A(param)  // how to do this ?
like image 558
nehz Avatar asked Mar 12 '16 13:03

nehz


1 Answers

Like this:

    member this.B(?param) = this.A(?param = param)

Using ? when providing a named optional parameter allows you to pass an option.

like image 174
Vandroiy Avatar answered Oct 17 '22 02:10

Vandroiy