Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
F# is a functional-first, multi-paradigm language for the .NET platform, designed by Don Syme at Microsoft Research and first released in 2005. This mode compiles your code the way a normal project does: the F# compiler produces a .NET assembly that then runs, so you work with an [<EntryPoint>], full type checking, and compiled performance. Following the ML tradition, F# defaults to immutable data and uses type inference to stay concise while remaining statically typed. It is used in finance, data science, and backend services by teams that want functional-style safety together with the .NET runtime and its libraries. On XCODX, F# runs in a cloud sandbox and is compiled before it runs, so you can try the language and the .NET standard library without installing the .NET SDK.
// Compiled F# on .NET: the entry point returns an int exit code
[<EntryPoint>]
let main argv =
printf "What is your name? "
let name = System.Console.ReadLine()
printfn "Hello, %s!" name
let total = [ 1 .. 5 ] |> List.sum
printfn "Sum of 1..5 is %d" total
0
Compiled F# fits shipping real .NET software with a functional accent: web backends with frameworks like Giraffe or ASP.NET Core, financial and quantitative models, data pipelines, and domain modeling where discriminated unions and records make illegal states hard to represent. You get the .NET runtime's performance and interop with the large C# and .NET library base. Choose it over the scripting mode when you need an entry point, multiple files, or predictable startup and speed. It is overkill for a three-line calculation you just want to evaluate once, where a script is quicker.
System.Console.ReadLine() returns the next line from standard input as a string, or null at end of input; parse it with int, System.Int32.Parse, or System.Double.Parse. On XCODX you can type into the live terminal or paste into the Stdin Box, and Ctrl+D closes the stream.
No. The sandbox compiles against the F# core library and the .NET base class library only, and it has no network access, so there is no NuGet restore and no paket. Third-party packages such as Giraffe or FSharp.Data are unavailable; use namespaces like System, System.Collections.Generic, and System.Text.
Yes for a compiled program: execution starts at the function marked [<EntryPoint>], which takes a string array of arguments and returns an int exit code, so end with 0 for success. This is the main difference from F# script mode, where top-level statements run without an entry point.
Compiled. The F# compiler turns your code into a .NET assembly that is then executed, so type and format-string errors are reported before anything runs. That differs from F# Interactive, which evaluates .fsx scripts as it reads them.
You can use anything in the .NET base class library that ships with the runtime, such as collections, text, math, and dates, because F# runs on the same runtime as C#. What you cannot do is pull in external NuGet assemblies, since there is no package restore or network access.
The F# and .NET versions are shown in the badge next to the editor. It is free with no signup and no local install, and each run starts from a fresh sandbox with no saved state.
main.fsmllikeConsole.ReadLine()// F# .NET Program
printfn "Hello from F#.NET!"
printfn "Welcome to XCODX Online Compiler!"
let numbers = [1..10]
let sum = List.sum numbers
let evens = List.filter (fun x -> x % 2 = 0) numbers
printfn "Numbers: %A" numbers
printfn "Sum: %d" sum
printfn "Evens: %A" evens
The .NET toolchain emits a spurious "Can't rename" line during compilation. It is suppressed on a successful build.