XCODX |

F# Interactive Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  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.
Success
Operation completed

About F# Interactive

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.

Hello World in F# Interactive

// 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

When to use F# Interactive

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.

Common questions

How do I read input in an F# script?

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.

Can I reference NuGet packages with #r?

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.

How is this different from compiled F#?

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.

Do I need a main function or a module?

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.

Why won't a value change, or why is my printf format rejected?

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.

Which F# and .NET version does XCODX run?

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.

How F# Interactive runs on XCODX

Sandbox filename
main.fsx
Entry point
main.fsx script entrypoint
Editor grammar
mllike
Reading stdin
Console.ReadLine()
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

// 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)