Skip to main content

Online Smalltalk Compiler

Write Smalltalk, press run and read the output in seconds. Nothing to install and nothing to configure.

How it works

Free, no install, works on laptop and phone.

What is an online Smalltalk compiler?

An online Smalltalk compiler is a free tool that lets you write Smalltalk code in your browser and run it to see the output, with nothing to install. On Techsnap you can add input, run a program in seconds and use it on a laptop or a phone.

Updated December 2026

How to run Smalltalk code online

  1. Step 1

    Write your Smalltalk code

    Open the editor and type or paste your Smalltalk program. Syntax colours and indentation help you spot mistakes as you go.

  2. Step 2

    Press Run

    Your code is sent to a secure server that compiles and runs it. Add any input the program needs in the Input box first.

  3. Step 3

    Read the output

    Results and error messages appear below the editor within a few seconds. Fix, edit and run again as often as you like.

Everything you need to code in Smalltalk

Nothing to install

No Smalltalk setup, PATH or version problems. It works on a college lab PC or a phone.

Input support

Give your program input the same way a judge or exam platform does, then check the output.

Instant results

Most runs finish in a second or two, so you can try an idea and see what happens right away.

Free to start

Run code without paying. A free Techsnap account gives you more runs and saves your work.

Smalltalk code examples

Open the editor, paste one of these examples in and run it. Change a value and run it again to see what happens.

Hello World in Smalltalk

Transcript showCr: 'Hello, Techsnap!'.

Variables and objects

| name age marks |
name := 'Asha'.
age := 21.
marks := 87.5.

Transcript showCr: name, ' ', age printString, ' ', marks printString.
Transcript showCr: age class printString.

Conditions

| marks |
marks := 72.

marks >= 90
    ifTrue: [Transcript showCr: 'Grade A']
    ifFalse: [
        marks >= 60
            ifTrue: [Transcript showCr: 'Grade B']
            ifFalse: [Transcript showCr: 'Needs work']].

Loops

| n |
1 to: 3 do: [:i | Transcript showCr: 'to:do: ', i printString].

3 timesRepeat: [Transcript showCr: 'repeat'].

n := 3.
[n > 0] whileTrue: [
    Transcript showCr: 'while: ', n printString.
    n := n - 1].

Blocks (closures)

| square add |
square := [:x | x * x].
add := [:a :b | a + b].

Transcript showCr: (square value: 7) printString.
Transcript showCr: (add value: 5 value: 8) printString.

Collections

| nums marks |
nums := OrderedCollection new.
nums add: 4; add: 9; add: 12; add: 15; add: 20.

Transcript showCr: (nums collect: [:n | n * 2]) printString.
Transcript showCr: (nums select: [:n | n even]) printString.
Transcript showCr: (nums inject: 0 into: [:a :b | a + b]) printString.

marks := Dictionary new.
marks at: 'DSA' put: 90.
Transcript showCr: (marks at: 'DSA') printString.

Defining a class

Object subclass: Student [
    | name marks |
    Student class >> name: aName marks: aMark [
        ^self new setName: aName marks: aMark
    ]
    setName: aName marks: aMark [
        name := aName.
        marks := aMark
    ]
    summary [
        ^name, ' scored ', marks printString
    ]
]

| s |
s := Student name: 'Ravi' marks: 78.
Transcript showCr: s summary.

Strings

| text |
text := 'online compiler'.

Transcript showCr: text asUppercase.
Transcript showCr: text size printString.
Transcript showCr: (text copyFrom: 1 to: 6).
Transcript showCr: text reversed.

Error handling with on:do:

[10 / 0]
    on: ZeroDivide
    do: [:e | Transcript showCr: 'Caught: cannot divide by zero'].

Transcript showCr: 'Done'.

Everything is an object

Transcript showCr: 3 class printString.
Transcript showCr: 3 even printString.
Transcript showCr: (3 max: 8) printString.
Transcript showCr: 10 factorial printString.
Transcript showCr: #symbol class printString.

How to take input in Smalltalk online

GNU Smalltalk reads a line of standard input with stdin nextLine. Convert it to a number with asNumber or asInteger.

| n nums total |
n := stdin nextLine asInteger.
nums := stdin nextLine substrings collect: [:s | s asInteger].

total := nums inject: 0 into: [:a :b | a + b].
Transcript showCr: 'count: ', n printString.
Transcript showCr: 'sum: ', total printString.

Common Smalltalk errors and how to fix them

doesNotUnderstand: #x
You sent a message the object does not know, usually a misspelled method name or a method called on the wrong kind of object.
undeclared variable x
A variable is used before it is declared. Declare it between vertical bars, for example | x y |, at the top.
expected ] / unmatched bracket
A block or class body is not closed. Count your square brackets.
Nothing prints
Use Transcript showCr: to print a line, and convert numbers to text first with printString.

Who uses an online Smalltalk compiler

Students and learners

Practise Smalltalk for class assignments and exams without installing anything.

Teachers and mentors

Share a short program in a lesson and let students run and change it on their own devices.

Interview candidates

Rehearse Smalltalk questions in the same plain editor many online tests use.

Working developers

Check a snippet or an API behaviour in seconds without opening an IDE.

Writers and bloggers

Test code samples so the examples in your tutorials really run.

Teams

Paste a reproducible example into a ticket or chat so everyone sees the same result.

Online compiler vs local Smalltalk setup

Techsnap online compilerLocal setup
Setup timeNone, open the pageInstall Smalltalk, set PATH, pick a version
Works on any deviceYes, any modern browserOnly the machine you set up
Best forPractice, quick tests, learningLarge projects and long-running work
Extra librariesStandard library onlyAnything you can install

About Smalltalk

What is Smalltalk?

Smalltalk is a pure object-oriented language created at Xerox PARC in the 1970s. Everything is an object, including numbers and classes, and all computation happens by sending messages to objects.

What is Smalltalk used for?

Teaching object-oriented design, research, and some business systems. It inspired many later languages: Objective-C, Ruby and Java all borrow ideas from it.

Smalltalk for beginners

Think in messages: 3 + 4 sends the message + to 3. Learn the three kinds of messages (unary, binary and keyword), blocks in square brackets and how to define a class with Object subclass:.

Smalltalk vs Java and Ruby

Smalltalk is more purely object-oriented than Java, where primitives are not objects, and its syntax is smaller than Ruby's. It is mostly used as a teaching and research language today.

Why use an online Smalltalk compiler?

Setting up Pharo or GNU Smalltalk takes some effort. An online Smalltalk runner lets you try the message-passing style straight away.

Smalltalk career opportunities

Smalltalk roles exist in finance and legacy systems, though they are few. Learning it makes you better at object-oriented thinking that applies in Java, C# and Python.

Explore more online compilers

Frequently asked questions

Is this online Smalltalk compiler free?

Yes. Write and run Smalltalk code in your browser for free, with nothing to install. A free Techsnap account gives you more runs and saves your work.

What does ^ mean in Smalltalk?

The caret returns a value from a method. Without it, a method returns the object itself.

How do I take input in Smalltalk online?

Use the Input box and read lines with stdin nextLine, as shown on this page.

Can I run Smalltalk on my phone?

Yes. The editor, input and output work in a mobile browser, so you can practise without a laptop.

Ready to write Smalltalk code?

Open the editor and run your first program in under a minute.