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

Counter and Theme Toggle - Rebol Typing CST Test

Loading…

Counter and Theme Toggle — Rebol Code

Demonstrates a simple counter with theme toggling using Rebol variables and functions.

count: 0
isDark: false

updateUI: func [] [
	print join "Counter: " count
	print join "Theme: " (either isDark ["Dark"] ["Light"])
]

increment: func [] [
	count: count + 1
	updateUI
]

decrement: func [] [
	count: count - 1
	updateUI
]

reset: func [] [
	count: 0
	updateUI
]

toggleTheme: func [] [
	isDark: not isDark
	updateUI
]

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

Rebol Language Guide

REBOL (Relative Expression-Based Object Language) is a lightweight, cross-platform programming language designed for network communications, data exchange, and scripting. It emphasizes simplicity, human-readable syntax, and rapid development of distributed applications.

Primary Use Cases

  • ▸Network protocols and communication
  • ▸Scripting and automation
  • ▸Rapid prototyping of applications
  • ▸Data exchange with custom dialects
  • ▸Embedded or lightweight distributed applications

Notable Features

  • ▸Lightweight and portable across platforms
  • ▸Human-readable, minimalistic syntax
  • ▸Support for DSLs (domain-specific languages) via dialects
  • ▸Built-in networking, GUI, and file-handling capabilities
  • ▸Dynamic typing with flexible data structures

Origin & Creator

Developed in 1997 by Carl Sassenrath, creator of the AmigaOS multitasking kernel.

Industrial Note

REBOL is particularly valued in environments where compact, portable scripts for networking, automation, or embedded systems are required.

More Rebol Typing Exercises

Rebol Fibonacci SequenceRebol Factorial CalculatorRebol Prime CheckerRebol Sum of BlockRebol Reverse StringRebol Multiplication TableRebol Celsius to FahrenheitRebol Simple Alarm SimulationRebol Random Walk Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher