Skip to content

Instantly share code, notes, and snippets.

@bleis-tift
Created May 27, 2017 07:34
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 bleis-tift/6762352cf702216d3d204165c7081cd5 to your computer and use it in GitHub Desktop.
Save bleis-tift/6762352cf702216d3d204165c7081cd5 to your computer and use it in GitHub Desktop.
//// シャドーイングの例
// これは無限ループ
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