Skip to content

Instantly share code, notes, and snippets.

@ArtemyB
Created March 20, 2023 15:51
Show Gist options
  • Save ArtemyB/b1baa6ae66de2ba4a7c07773f4728d3d to your computer and use it in GitHub Desktop.
Save ArtemyB/b1baa6ae66de2ba4a7c07773f4728d3d to your computer and use it in GitHub Desktop.
// Inferred return type: `'a list`
let implicitYield (f: int -> unit) = [
for i in 0 .. 3 do
if i = 2 then f i
else printf "Not 2"
]
// Inferred return type: `unit list`
let explicitYield (f: int -> unit) = [
for i in 0 .. 3 do
if i = 2 then yield f i
else printf "Not 2"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment