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

  • .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]
主站蜘蛛池模板: 出国| 修文县| 堆龙德庆县| 南靖县| 毕节市| 米脂县| 河西区| 永清县| 静安区| 思茅市| 满洲里市| 德安县| 连平县| 金山区| 班戈县| 河池市| 万全县| 桂林市| 高台县| 突泉县| 邻水| 临泽县| 南丰县| 历史| 图木舒克市| 阿巴嘎旗| 凌海市| 余庆县| 稻城县| 鄱阳县| 石嘴山市| 万山特区| 鄂伦春自治旗| 海林市| 于田县| 呼图壁县| 长岛县| 山东| 阳泉市| 崇仁县| 阿鲁科尔沁旗|