Created
March 20, 2023 15:51
-
-
Save ArtemyB/b1baa6ae66de2ba4a7c07773f4728d3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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