Last active
March 28, 2017 19:41
-
-
Save controlflow/946cd12821545c37c9c80b8e454e9342 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
while (GetSomethingToUseTwice() is var x | |
&& x != null | |
&& UseOnceMore(x) | |
&& AndMore(x)) | |
{ | |
// ... | |
} | |
// C#'s 'is var t' var pattern to introduce a name for expression where statements are not allowed | |
// is somewhat similar to 'let-in' from functional languages: |
This file contains hidden or 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
let f () = | |
someFunction | |
"firstArg" | |
secondArg | |
(let x = getSomethingToUseTwice() | |
in useOnceMore x (andMore x)) | |
fourthArg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment