Hello World
echo "Hello, World!"Tap Run to execute
main.nim · output appears here
Press Run to execute
Output streams here as your program runs.
Nim is a statically typed, compiled systems programming language created by Andreas Rumpf, with its first public release in 2008. It compiles to C, C++, or JavaScript, giving it broad portability and performance close to that of C while offering a clean, Python-influenced indentation-based syntax. Nim combines low-level control with high-level expressiveness and efficient native binaries.
Nim supports multiple paradigms including procedural, object-oriented, and functional styles, and features powerful compile-time evaluation and a hygienic macro system for metaprogramming. It offers flexible memory management with optional garbage collection or manual control, making it suitable for everything from embedded software and game development to web backends and command-line tools.
main.nim is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.nim imports helper.nim; the asterisk exports the helper procedure.
import helper
echo answer()
proc answer*(): int =
42
echo "Hello, World!"let name = readLine(stdin)
echo "Hello, ", name, "!"let nums = @[1, 2, 3, 4]
for n in nums:
echo n * nproc add(a, b: int): int =
a + b
echo add(2, 3)import tables
var ages = {"alice": 30, "bob": 25}.toTable
ages["carol"] = 28
for name, age in ages:
echo name, " is ", agetype
Point = object
x, y: int
proc `$`(p: Point): string =
"(" & $p.x & ", " & $p.y & ")"
let p = Point(x: 3, y: 4)
echo pimport sequtils, strutils
let nums = @[1, 2, 3, 4, 5]
echo nums.map(proc(x: int): int = x * x)
echo nums.filter(proc(x: int): bool = x mod 2 == 0)
echo nums.foldl(a + b, 0)import strutils
try:
let n = parseInt("42")
echo n * 2
except ValueError:
echo "Not a valid number"type
Direction = enum
North, East, South, West
proc describe(d: Direction): string =
case d
of North: "up"
of South: "down"
else: "sideways"
for d in [North, East, South]:
echo d, ": ", describe(d)iterator countUpBy(start, stop, step: int): int =
var i = start
while i <= stop:
yield i
i += step
for n in countUpBy(0, 10, 2):
echo nThe editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Nim is one of 23 linked-project compilers. Run always starts main.nim; selecting a helper tab changes what you edit, not the entry file.
main.nim imports helper.nim; the asterisk exports the helper procedure.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Nim tab and a README in one ZIP archive.