1. Home
  2. /
  3. Io
  4. /
  5. Counter and Theme Toggle

Counter and Theme Toggle - Io Typing CST Test

Loading…

Counter and Theme Toggle — Io Code

Demonstrates a simple counter with theme toggling using Io objects and message passing.

count := 0
isDark := false

updateUI := method(
	write("Counter: " .. count .. "\n")
	write("Theme: " .. (if(isDark, "Dark", "Light")) .. "\n")
)

increment := method(
	count = count + 1
	updateUI()
)

decrement := method(
	count = count - 1
	updateUI()
)

reset := method(
	count = 0
	updateUI()
)

toggleTheme := method(
	isDark = !isDark
	updateUI()
)

# Simulate actions
updateUI()
increment()
increment()
toggleTheme()
decrement()
reset()

Io Language Guide

Io is a small, prototype-based, object-oriented programming language designed for simplicity, concurrency, and rapid development of distributed applications. It emphasizes minimal syntax, message-passing, and highly dynamic objects.

Primary Use Cases

  • ▸Scripting and automation
  • ▸Embedded system programming
  • ▸Prototyping distributed applications
  • ▸Rapid development of domain-specific languages
  • ▸Concurrent and asynchronous programming

Notable Features

  • ▸Prototype-based object system (no classes)
  • ▸Minimal and consistent syntax
  • ▸Message-passing as primary mechanism
  • ▸Concurrency via coroutines
  • ▸Embeddable and portable interpreter

Origin & Creator

Developed in 2002 by Steve Dekorte.

Industrial Note

Io is valued in niche domains where lightweight, dynamic, and concurrent scripting is required, particularly in experimental software, rapid prototyping, and small-scale distributed systems.

More Io Typing Exercises

Io Fibonacci SequenceIo Factorial CalculatorIo Prime CheckerIo Sum of ListIo Reverse StringIo Multiplication TableIo Celsius to FahrenheitIo Simple Alarm SimulationIo Random Walk Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher