XCODX |

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

Smalltalk, designed by Alan Kay's team at Xerox PARC in the 1970s, is where modern object-oriented programming was invented: everything is an object, all computation happens through message passing, and even control flow like ifTrue: is just a message sent to a Boolean. Its ideas shaped Objective-C, Ruby, Python, and the MVC pattern itself. The code on this page runs under GNU Smalltalk, a scripting-friendly implementation that executes plain source files rather than requiring a graphical image. The attached terminal is fully interactive, so expressions like stdin nextLine actually pause and wait for your keyboard, letting you experience live message-driven programs with nothing installed.

Hello World in Smalltalk

| name square |
Transcript showCr: 'What is your name?'.
name := stdin nextLine.
Transcript showCr: 'Hello, ', name, '! Everything here is an object.'.

square := [:n | n * n].
1 to: 4 do: [:i |
    Transcript showCr: i printString, ' squared is ', (square value: i) printString].

#(3 1 4 1 5 9) asSortedCollection do: [:each |
    Transcript show: each printString, ' '].
Transcript cr.

When to use Smalltalk

Smalltalk is the classic vehicle for teaching pure object orientation in programming-languages courses, since concepts like message passing, blocks as first-class closures, and metaclasses appear here in their original form. Developers studying Ruby's design or the history of MVC, test-driven development, and refactoring tools (all pioneered in Smalltalk environments) use this page to run canonical examples. It also serves maintainers of legacy Smalltalk systems in finance and shipping who want a quick scratchpad for collection protocols and cascades without launching a full image.

Common questions

Can Smalltalk code read what I type in the terminal?

Yes. GNU Smalltalk exposes standard input as the stdin object, and sending it nextLine blocks until you enter a line in the live terminal. Combined with Transcript showCr: for output, you can write interactive scripts, prompts, and simple text games entirely in message-passing style.

Which Smalltalk dialect does this page run?

Code executes under GNU Smalltalk, which reads ordinary text source files, making it ideal for a browser terminal. Pharo and Squeak, the popular image-based environments, share the same core language and collection protocols, so most expressions transfer directly; what you will not find here are their graphical browsers and Morphic UI tools.

Why does 'everything is a message' matter in practice?

In Smalltalk even conditionals and loops are messages: ifTrue: is sent to a Boolean object with a block argument, and to:do: is a message to a number. There is no privileged syntax layer, so the language stays tiny and uniform, and you can inspect or override nearly any behavior, which is the property later languages like Ruby borrowed.

How Smalltalk runs on XCODX

Sandbox filename
main.st
Entry point
single main source file
Editor grammar
text/x-stsrc
Reading stdin
stdin
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

"Smalltalk Program"
Transcript show: 'Hello from Smalltalk!'; cr.
Transcript show: 'Welcome to XCODX Online Compiler!'; cr.

| numbers sum |
numbers := #(1 2 3 4 5).
sum := numbers inject: 0 into: [:a :b | a + b].
Transcript show: 'Sum of 1-5: ', sum printString; cr.