1. Home
  2. /
  3. Ada Typing Test
  4. /
  5. Counter and Theme Toggle

Counter and Theme Toggle - Ada Typing CST Test

Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
with Ada.Text_IO; use Ada.Text_IO;
procedure Counter is
Count : Integer := 0;
Is_Dark : Boolean := False;

procedure Update_UI is
begin
Put_Line("Counter: " & Integer'Image(Count));
Put_Line("Theme: " & (if Is_Dark then "Dark" else "Light"));
end Update_UI;

begin
-- Initial display
Update_UI;

-- Increment counter
Count := Count + 1;
Update_UI;

-- Increment counter again
Count := Count + 1;
Update_UI;

-- Toggle theme
Is_Dark := not Is_Dark;
Update_UI;

-- Decrement counter
Count := Count - 1;
Update_UI;

-- Reset counter
Count := 0;
Update_UI;
end Counter;
Coding works best on desktop or with an external keyboard.
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.

Counter and Theme Toggle — Ada Code

Demonstrates a simple counter with theme toggling using Ada variables and console output.

with Ada.Text_IO; use Ada.Text_IO;
procedure Counter is
	Count : Integer := 0;
	Is_Dark : Boolean := False;

	procedure Update_UI is
	begin
		Put_Line("Counter: " & Integer'Image(Count));
		Put_Line("Theme: " & (if Is_Dark then "Dark" else "Light"));
	end Update_UI;

begin
	-- Initial display
	Update_UI;

	-- Increment counter
	Count := Count + 1;
	Update_UI;

	-- Increment counter again
	Count := Count + 1;
	Update_UI;

	-- Toggle theme
	Is_Dark := not Is_Dark;
	Update_UI;

	-- Decrement counter
	Count := Count - 1;
	Update_UI;

	-- Reset counter
	Count := 0;
	Update_UI;
end Counter;

Ada Language Guide

Ada is a statically typed, high-level programming language designed for safety-critical, real-time, and concurrent systems. Developed with reliability and maintainability in mind, Ada emphasizes strong typing, modularity, exception handling, and support for concurrent programming.

Primary Use Cases

  • ▸Safety-critical avionics systems
  • ▸Real-time embedded software
  • ▸Railway signaling and control
  • ▸Defense and military software
  • ▸Medical device software
  • ▸High-integrity systems requiring formal verification

Notable Features

  • ▸Strong static typing and compile-time checks
  • ▸Support for tasking (concurrency)
  • ▸Exception handling and robust error management
  • ▸Package-based modularity
  • ▸Design-by-contract with pre/post conditions

Origin & Creator

Ada was commissioned by the U.S. Department of Defense in the late 1970s and early 1980s, designed by Jean Ichbiah and his team at CII Honeywell Bull under the name 'Ada' in honor of Ada Lovelace.

Industrial Note

Ada is essential in avionics, railway control systems, nuclear power plant software, medical devices, and mission-critical defense applications where software failure is unacceptable.

Quick Explain

  • ▸Ada supports structured, object-oriented, and concurrent programming paradigms.
  • ▸It is widely used in aerospace, defense, transportation, and other safety-critical systems.
  • ▸Its compiler enforces strict type checking, which reduces runtime errors and improves reliability.

Core Features

  • ▸Procedures, functions, and packages
  • ▸Tasking and protected types for concurrency
  • ▸Generics for reusable code
  • ▸Exception handling
  • ▸Strong typing and subtyping

Learning Path

  • ▸Learn Ada syntax and strong typing
  • ▸Understand procedures, functions, and packages
  • ▸Explore tasking and concurrency
  • ▸Practice exception handling
  • ▸Apply Ada to real-time and embedded systems

Practical Examples

  • ▸Hello World console program
  • ▸Concurrent producer-consumer tasks
  • ▸Embedded system sensor interface
  • ▸Railway signal control logic
  • ▸Flight software for avionics

Comparisons

  • ▸More robust than C/C++ for safety-critical systems
  • ▸Less flexible for rapid scripting than Python or Ruby
  • ▸Concurrency model safer than traditional threads
  • ▸Strong typing prevents many runtime errors
  • ▸Better for certified systems than general-purpose languages

Strengths

  • ▸High reliability and maintainability
  • ▸Excellent support for concurrent and real-time systems
  • ▸Compile-time type safety reduces runtime errors
  • ▸Modular design encourages clean architecture
  • ▸Widely used in certified, high-integrity systems

Limitations

  • ▸Steep learning curve for beginners
  • ▸Less community support compared to mainstream languages
  • ▸Verbose syntax relative to modern scripting languages
  • ▸Smaller ecosystem of libraries for general-purpose programming
  • ▸Not ideal for rapid prototyping or casual applications

When NOT to Use

  • ▸Rapid prototyping or scripting
  • ▸Casual web development
  • ▸GUI-heavy desktop apps
  • ▸Games and graphics-intensive apps
  • ▸Machine learning with extensive libraries

Cheat Sheet

  • ▸with Ada.Text_IO; use Ada.Text_IO;
  • ▸procedure Main is
  • ▸ begin Put_Line('Hello World');
  • ▸end Main;
  • ▸task type Worker is ... end Worker;

FAQ

  • ▸Is Ada still used today?
  • ▸Yes - in aerospace, defense, railways, and other safety-critical industries.
  • ▸Can Ada handle concurrency?
  • ▸Yes - Ada provides tasking and protected types.
  • ▸Is Ada suitable for beginners?
  • ▸It has a steep learning curve but excellent for safety-critical programming.
  • ▸Does Ada support object-oriented programming?
  • ▸Yes - Ada supports OOP with tagged types and inheritance.

30-Day Skill Plan

  • ▸Week 1: Basic syntax, variables, and procedures
  • ▸Week 2: Packages, modularity, and type system
  • ▸Week 3: Tasking, concurrency, and protected types
  • ▸Week 4: Exception handling and real-time programming

Final Summary

  • ▸Ada is a high-integrity, strongly typed language for safety-critical and real-time systems.
  • ▸Ideal for avionics, defense, transportation, and embedded applications.
  • ▸Its strict typing, modularity, and concurrency features make it reliable and maintainable.
  • ▸Ada continues to be relevant in certified, mission-critical software development.

Project Structure

  • ▸source.adb (body)
  • ▸source.ads (specification)
  • ▸packages/
  • ▸tests/
  • ▸Makefiles or GNAT project files (.gpr)

Monetization

  • ▸Defense and aerospace contracts
  • ▸Medical device software development
  • ▸Railway and transportation control systems
  • ▸Consulting in real-time and safety-critical systems
  • ▸High-integrity software engineering services

Productivity Tips

  • ▸Use packages for modularity
  • ▸Follow strict naming conventions
  • ▸Test tasks and concurrency carefully
  • ▸Leverage SPARK for verification
  • ▸Use Makefiles or GNAT project files to automate builds

Basic Concepts

  • ▸Strong typing and variable declarations
  • ▸Procedures and functions
  • ▸Packages and modularity
  • ▸Tasking and concurrency
  • ▸Exception handling

Official Docs

  • ▸Ada Reference Manual
  • ▸AdaCore GNAT User Guide
  • ▸SPARK Ada Verification Guide

More Ada Typing Exercises

Ada Simple AdditionAda FactorialAda Fibonacci SequenceAda Max of Two NumbersAda List SumAda Even Numbers FilterAda Conditional Counter IncrementAda Resettable CounterAda Theme Toggle Only

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher