Created
May 27, 2017 07:34
-
-
Save bleis-tift/6762352cf702216d3d204165c7081cd5 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
//// シャドーイングの例 | |
// これは無限ループ | |
let x = 0 | |
while x < 10 do // ここでのxは常に最初のx | |
let x = x + 1 // 新しいxのスコープはwhileの本体のみで有効 | |
printfn "%d" x | |
//// 再代入の例 | |
// これは無限ループにならない | |
let mutable x = 0 | |
while x < 10 do | |
x <- x + 1 | |
printfn "%d" x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment