What's the reason of marking a recursive function as rec in F#?

后端 未结 5 1153
长情又很酷
长情又很酷 2020-12-31 04:04

I am not sure if this is a stupid question but I was going through the tutorial that comes with VS 2010 and there is a function like this:

let rec factorial          


        
5条回答
  •  无人及你
    2020-12-31 04:41

    According to the MSDN, it's only a syntatic necessity:

    Recursive functions, functions that call themselves, are identified explicitly in the F# language. This makes the identifer that is being defined available in the scope of the function.

    http://msdn.microsoft.com/en-us/library/dd233232.aspx

提交回复
热议问题