Skip to content

Instantly share code, notes, and snippets.

@En3Tho
Created November 14, 2020 10:57
Show Gist options
  • Save En3Tho/25ecaafbb6472591cdd9e9db240a9c6f to your computer and use it in GitHub Desktop.
Save En3Tho/25ecaafbb6472591cdd9e9db240a9c6f to your computer and use it in GitHub Desktop.
type IOptionalParameter =
abstract member Do: count: int * [<Optional; DefaultParameterValue 10>] length : int -> unit
type OptionalParameter() =
member _.Do(count, [<Optional; DefaultParameterValue 10>]length) = printf "%i" (count + length)
interface IOptionalParameter with
member this.Do(count, length) =
this.Do(count, length)
let op1 = OptionalParameter().Do 12
let op2 = OptionalParameter().Do(12, 25)
let op3 = (OptionalParameter() :> IOptionalParameter).Do 12
let op4 = (OptionalParameter() :> IOptionalParameter).Do(12,25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment