F#

可輕鬆撰寫簡潔、健全且出色的程式碼的開放原始碼語言。

開始使用

在 Windows、Linux 及 macOS 上受支援

// 'name' is inferred to be a string based on usage.
let printMessage name =
    printfn $"Hello there, {name}!"

// 'names' is inferred to be a sequence of strings.
let printNames names =
    for name in names do
        printMessage name

let names = [ "Ana"; "Felipe"; "Emillia" ]
printNames names
                                     
let square x = x * x
let isOdd x = x % 2 <> 0

let sumOfOddSquares nums =
    nums
    |> List.filter isOdd
    |> List.sumBy square

let numbers = [1; 2; 3; 4; 5]
let sum = sumOfOddSquares numbers

printfn "The sum of the odd squares in %A is %d" numbers sum
type Shape =
    | Square of side: double
    | Rectangle of width: double * length: double

let getArea shape =
    match shape with
    | Square side -> side * side
    | Rectangle (width, length) -> width * length

let square = Square 2.0
printfn $"The area of the square is {getArea square}"
                                   
type Customer(firstName, middleInitial, lastName) =
    member this.FirstName = firstName
    member this.MiddleInitial = middleInitial
    member this.LastName = lastName

    member this.SayFullName() =
        $"{this.FirstName} {this.MiddleInitial} {this.LastName}"

let customer = Customer("Emillia", "C", "Miller")

printfn $"Hello, I'm {customer.SayFullName()}!"
                                   

簡明、強固且有效能

F# 具有輕量型語法,需要極少的程式碼即可建置軟體。它由功能強大的型別系統、便利的標準程式庫和 .NET 執行階段支援,因此您可以信任並用於建置正確、快速且可靠的任務關鍵性軟體。

開始使用 F#

資料科學與 ML 的 F#

F# 能以各種方式使用,從建置基本 Web API 到執行資料操作、互動式程式設計、資料科學及機器學習皆適用。

F# 的類型系統和唯一功能,例如型別提供者測量單位非常適合用於資料科學與機器學習。

所有地方的專業工具

適用於 Windows, Linux, and macOS 的高品質編輯器全都在單一 F# 編譯器上執行,並提供一致性的高品質功能。

了解適用於 F# 的工具

Microsoft + 社群

F# 是開放原始碼語言,而 Microsoft 是領導的參與者。獨立的 F# Software Foundation 提供一個中央位置,讓 F# 社群共同成長和學習。

F# 軟體基礎網站

在 .NET 上執行

F# 是 .NET 開發人員平台的一部分。使用您的技能、程式碼及我的最愛程式庫來建立所有類型的應用程式。

了解 .NET 平台

準備開始了嗎?

我們的逐步教學課程可協助您讓 F# 在電腦上執行。

開始使用