Skip to content

Instantly share code, notes, and snippets.

@eriawan
Last active July 15, 2016 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eriawan/1319ec5f96ed42874cc249db5d209a99 to your computer and use it in GitHub Desktop.
Save eriawan/1319ec5f96ed42874cc249db5d209a99 to your computer and use it in GitHub Desktop.
test F# code in table of markdown

Verbose syntax

Language construct Lightweight syntax Verbose syntax
compound expressions
; 

nested let bindings

``` let f x = let a = 1 let b = 2 x + a + b ```
let f x =
    let a = 1 in
    let b = 2 in
    x + a + b
code block
<expression1>
<expression2>
...
begin
    <expression1>;
    <expression2>;
end
**for...do**
for counter = start to finish do
    ...
for counter = start to finish do
    ...
done
**while...do**
while <condition> do
    ...
while <condition> do
    ...
done
**for...in**
for var in start .. finish do
    ...
for var in start .. finish do
    ...
done
**do**
do
    ...
do
    ...
in
record
type <record-name> =
    {
        <field-declarations>
    }
    <value-or-member-definitions>
type <record-name> =
    {
        <field-declarations>
    }
    with
        <value-or-member-definitions>
    end
class ``` type () = ... ```
type <class-name>(<params>) =
    class
        ...
    end
structure
[<StructAttribute>]
type <structure-name> =
    ...
type <structure-name> =
    struct
        ...
    end
discriminated union
type <union-name> =
    | ...
    | ...
    ...
    <value-or-member definitions>
type <union-name> =
    | ...
    | ...
    ...
    with
        <value-or-member-definitions>
    end    
interface
type <interface-name> =
    ...
type <interface-name> =
    interface
        ...
    end
object expression
{ new <type-name>
    with
        <value-or-member-definitions>
        <interface-implementations>
}
{ new <type-name>
    with
        <value-or-member-definitions>
    end
    <interface-implementations>
}
interface implementation
interface <interface-name>
    with
        <value-or-member-definitions>
interface <interface-name>
    with
        <value-or-member-definitions>
    end
type extension
type <type-name>
    with
        <value-or-member-definitions>
type <type-name>
    with
        <value-or-member-definitions>
    end
module
module <module-name> =
    ...
module <module-name> =
    begin
        ...
    end

Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment