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 language on the .NET platform, designed by Don Syme at Microsoft Research and first released in 2005. This mode runs it through F# Interactive, the same engine behind the dotnet fsi command, which evaluates .fsx script files top to bottom without a separate build step. F# brings the ML family's type inference and immutable-by-default style together with access to the .NET base class library. The scripting form is common for data exploration, quick calculations, and prototyping, since you write top-level code and see results immediately. On XCODX, F# Interactive runs in a cloud sandbox, so you can try the language and the .NET standard library without installing the .NET SDK.
// F# Interactive script (.fsx): read a line, then sum a range
printf "What is your name? "
let name = stdin.ReadLine()
printfn "Hello, %s!" name
let total = [ 1 .. 5 ] |> List.sum
printfn "Sum of 1..5 is %d" total
F# Interactive suits interactive, exploratory work: load a script, run a snippet, and inspect the result in seconds without project scaffolding. It is a good match for data wrangling, one-off automation, teaching functional concepts, and trying .NET APIs before committing them to a compiled project. Because scripts run top to bottom, they keep small tasks small. It is not the right tool for shipping a packaged application or a latency-critical service; for that you compile the same F# code into a .NET assembly instead.
Call stdin.ReadLine() or System.Console.ReadLine() to read one line as a string, then convert with int, float, or System.Int32.Parse. On XCODX you can type into the live terminal, where the script pauses at ReadLine until you press Enter, or paste into the Stdin Box up front, and Ctrl+D closes the stream.
Not here. F# Interactive normally supports #r "nuget:...", but the sandbox has no network access, so nothing can be downloaded. You get the F# core library and the .NET base class library only, including List, Array, and Seq and namespaces such as System and System.Text.
This mode evaluates .fsx scripts through F# Interactive as it reads the file, so there is no separate build and top-level statements run directly. Compiled F# turns .fs files into a .NET assembly ahead of time. The language is the same; only the execution model differs.
No. Script files execute top-level expressions in order, so you can call printfn and bind values with let at the top level. An [<EntryPoint>] main function belongs to compiled programs, not scripts.
F# values are immutable unless you write let mutable, and printf and printfn use type-checked format specifiers such as %d, %s, and %A. A specifier that does not match its argument's type is a compile-time error, caught before the script runs.
The versions are shown in the badge next to the editor. It is free with no signup and no local install, and each run executes in a fresh sandbox with no saved state.
main.fsxmllikeConsole.ReadLine()// F# Interactive
printfn "Hello from F# Interactive!"
printfn "Welcome to XCODX Online Compiler!"
let factorial n =
let mutable result = 1
for i in 1..n do
result <- result * i
result
printfn "5! = %d" (factorial 5)
printfn "10! = %d" (factorial 10)