1. Home
  2. /
  3. Seed7
  4. /
  5. Counter and Theme Toggle - Using Constants

Counter and Theme Toggle - Using Constants - Seed7 Typing CST Test

Loading…

Counter and Theme Toggle - Using Constants — Seed7 Code

Uses constants for theme strings instead of inline text.

const darkTheme: string := "Dark";
const lightTheme: string := "Light";
var count: integer := 0;
var isDark: boolean := false;

procedure updateUI;
begin
	put "Counter: "; put count; putnl;
	put "Theme: "; put (if isDark then darkTheme else lightTheme); putnl;
end procedure;

procedure toggleTheme;
begin
	isDark := not isDark;
	updateUI;
end procedure;

# Simulate actions
updateUI;
toggleTheme;

Seed7 Language Guide

Seed7 is a high-level, general-purpose programming language designed for extreme flexibility, strong typing, and extensible syntax. It allows developers to define new operators, statements, and even change the language’s grammar, making it one of the most customizable languages ever created. It focuses on safety, readability, and powerful abstractions.

Primary Use Cases

  • ▸Domain-Specific Languages (DSLs)
  • ▸Algorithmic and numerical computing
  • ▸Parser and compiler development
  • ▸Scripting and automation
  • ▸General-purpose application development

Notable Features

  • ▸User-defined syntax and operators
  • ▸Powerful type system with parametric polymorphism
  • ▸Native code generation via C backend
  • ▸Large standard library
  • ▸Extensible language semantics and grammar

Origin & Creator

Created by Thomas Mertes starting in 2005 as an ambitious alternative to Ada, Pascal, and other extensible languages.

Industrial Note

Seed7 is used in academic environments and by enthusiasts who need custom domain-specific languages (DSLs), interpreters, and complex mathematical/linguistic processing systems. Its extensibility makes it ideal for prototyping language constructs and embedded DSLs.

More Seed7 Typing Exercises

Seed7 Counter and Theme Toggle - BasicSeed7 Counter and Theme Toggle - With DecrementSeed7 Counter and Theme Toggle - Reset ExampleSeed7 Counter and Theme Toggle - Inline Theme ToggleSeed7 Counter and Theme Toggle - With Conditional DisplaySeed7 Counter and Theme Toggle - While Loop SimulationSeed7 Counter and Theme Toggle - Function Parameter StyleSeed7 Counter and Theme Toggle - Using Boolean Toggle FunctionSeed7 Counter and Theme Toggle - Combined Increment and Toggle

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher