Immutable values in F#

Posted by rsteckly on Stack Overflow See other posts from Stack Overflow or by rsteckly
Published on 2010-04-12T17:22:25Z Indexed on 2010/04/12 17:33 UTC
Read the original article Hit count: 362

Filed under:
|

I'm just getting started in F# and have a basic question.

Here's the code:

let rec forLoop body times =
    if times <= 0 then
      ()
    else
        body()
        forLoop body (times -1)

I don't get the concept of how when you define a variable it is a value and immutable. Here, the value is changing in order to loop. How is that different from a variable in C#?

© Stack Overflow or respective owner

Related posts about F#

Related posts about beginner