Smalltalk Online Compiler

About the Smalltalk compiler

The original object-oriented language. Compiled online. Run Smalltalk code in your browser with no install and no signup — the editor, the input and the output share one screen. Smalltalk is executed by a remote runtime: your code is submitted to it and the output is returned to this page.

Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.

A Smalltalk example

This is the program the Smalltalk editor opens with — run it as it is, then change it.

| students sorted total avg |
Transcript show: 'Smalltalk Student Report'; cr.
Transcript show: '----------------------------------------'; cr.
students := OrderedCollection new
    add: (Array with: 'Alice' with: 92);
    add: (Array with: 'Bob' with: 87);
    add: (Array with: 'Charlie' with: 95);
    add: (Array with: 'Diana' with: 88);
    yourself.
sorted := students asSortedCollection: [:a :b | (a at: 2) > (b at: 2)].
sorted doWithIndex: [:s :i |
    Transcript
        show: i printString, '. ';
        show: (s at: 1);
        tab;
        show: (s at: 2) printString; cr].
total := 0.
students do: [:s | total := total + (s at: 2)].
avg := total / students size.
Transcript cr.
Transcript show: 'Average: ', avg printString; cr.
Transcript show: 'Total: ', total printString; cr.

More Functional compilers

Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.