What is the “let” keyword in functional languages like F# and OCaml for?

前端 未结 6 1413
一向
一向 2020-12-20 11:51

When looking at F#, Ocaml and other functional language code examples I notice that the let keyword is used very often.

  • Why do you need it? Why were the langua
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 12:40

    The main purpose of "let" is putting a scope around its definitions.

    let in

    Makes sure that the definitions don't pollute the namespace of anything other than .

提交回复
热议问题