如何在F#中使用逗号后获取数字

时间:2017-07-09 09:45:15

标签: f#

我希望在F#中逗号后得到4个数字: 这是我的代码:

// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.

open System

[<EntryPoint>]
let main argv = 

    let num = Console.ReadLine() |> float
    Console.WriteLine(num)

    Console.Read() |>ignore
    0

1 个答案:

答案 0 :(得分:3)

这就是结果:

open System

[<EntryPoint>]
let main argv = 

    let num = Math.Round(Console.ReadLine() |> float, 3) 
    Console.WriteLine(num)

    Console.Read() |>ignore
    0