官术网_书友最值得收藏!

  • .NET Core 2.0 By Example
  • Rishabh Verma Neha Shrivastava
  • 139字
  • 2021-06-24 18:31:00

Calling a function

A function can be called by passing the function name followed, by a space, and then arguments (if any) separated by spaces, as shown here:

let sum = addValue 3

We can perform many tasks using F# functions, some of which are as follows:

  • We can create a new function and link that function with a type as it acts as a variable type:
    let square x = x*x
  • We can perform some calculations as well, such as:
    let square x = x*x
  • We can assign a value. Taking the same example:
    let square x = x*x
  • We can pass a function as a parameter to another function like this:
    let squareValue = List.map square[1;2;3] // using square function
  • We can return a function as a result of another function example:
    let squareValue = List.map square[1;2;3]
主站蜘蛛池模板: 富阳市| 西充县| 富源县| 宣威市| 海林市| 西藏| 环江| 开鲁县| 雷波县| 明星| 侯马市| 淅川县| 佛山市| 临武县| 堆龙德庆县| 苍南县| 石阡县| 郸城县| 大洼县| 涡阳县| 宝应县| 资溪县| 中阳县| 台东市| 峨眉山市| 灌阳县| 全南县| 临海市| 尚义县| 沾益县| 台前县| 竹溪县| 台安县| 黄陵县| 莱阳市| 尼勒克县| 普安县| 宁城县| 磐安县| 咸阳市| 黔西|