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.
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.
| 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.
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.
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.
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.
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.
main.sttext/x-stsrcstdin"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.