F# code formatting example
This page is rendered from a F# script as input, containing real F# code besides this markdown section.
hover above some bindings to get tooltips like in a real editor environment.
///this is comment
let a = 42
|
// see some operators/keywords:
if a > 0 then printfn "see, this is included: %i" a
// an interface:
type IA =
abstract member B : string -> string
// an interface implementation:
type C() =
interface IA with
member _.B(a) = id a
let d = C() :> IA
let e = d.B("soos")
|
module ThisIsAModule =
type Union =
| First
| Second of IA
type Enum =
| First = 1
| Second = 2
val a: int
this is comment
this is comment
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
type IA =
abstract B: string -> string
abstract IA.B: string -> string
Multiple items
val string: value: 'T -> string
--------------------
type string = System.String
val string: value: 'T -> string
--------------------
type string = System.String
type C =
interface IA
new: unit -> C
Multiple items
abstract IA.B: string -> string
--------------------
override C.B: a: string -> string
abstract IA.B: string -> string
--------------------
override C.B: a: string -> string
val a: string
val id: x: 'T -> 'T
val d: IA
new: unit -> C
val e: string
type Union =
| First
| Second of IA
union case Union.First: Union
union case Union.Second: IA -> Union
[<Struct>]
type Enum =
| First = 1
| Second = 2
Enum.First: Enum = 1
Enum.Second: Enum = 2