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

Counter and Theme Toggle - Gambas Typing CST Test

Loading…

Counter and Theme Toggle — Gambas Code

Demonstrates a simple counter with theme toggling using Gambas variables and procedures.

DIM count AS INTEGER = 0
DIM isDark AS BOOLEAN = FALSE

PROCEDURE updateUI()
	PRINT "Counter: "; count
	IF isDark THEN
		PRINT "Theme: Dark"
	ELSE
		PRINT "Theme: Light"
	END IF
END PROCEDURE

PROCEDURE increment()
	count += 1
	updateUI()
END PROCEDURE

PROCEDURE decrement()
	count -= 1
	updateUI()
END PROCEDURE

PROCEDURE reset()
	count = 0
	updateUI()
END PROCEDURE

PROCEDURE toggleTheme()
	isDark = NOT isDark
	updateUI()
END PROCEDURE

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

Gambas Language Guide

Gambas is a free, object-oriented programming language and development environment based on BASIC, designed primarily for Linux. It allows rapid development of graphical, database, and console applications, with a visual IDE similar to Visual Basic.

Primary Use Cases

  • ▸Developing Linux GUI applications
  • ▸Rapid prototyping for desktop software
  • ▸Database applications with MySQL, PostgreSQL, or SQLite
  • ▸Educational purposes for learning programming
  • ▸Small utility and productivity tools on Linux

Notable Features

  • ▸Visual IDE with drag-and-drop form designer
  • ▸Object-oriented extensions to BASIC
  • ▸Database and SQL support
  • ▸Multimedia and networking libraries
  • ▸Cross-platform support via Linux and some BSDs

Origin & Creator

Created by Benoît Minisini in 1999 as an open-source alternative to Visual Basic for Linux.

Industrial Note

Gambas is primarily used for rapid prototyping, educational projects, and Linux desktop applications where cross-platform or Windows compatibility is not required.

More Gambas Typing Exercises

Gambas Random Number GeneratorGambas Todo ListGambas Dice RollerGambas Countdown TimerGambas Prime CheckerGambas Temperature ConverterGambas Shopping CartGambas Name GreetingGambas Stopwatch

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher