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

Counter and Theme Toggle - Logo Typing CST Test

Loading…

Counter and Theme Toggle — Logo Code

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

make "count 0
make "isDark 0

to updateUI
	print (sentence "Counter: :count)
	print (sentence "Theme: (if :isDark = 1 [Dark] [Light]))
end

to increment
	make "count :count + 1
	updateUI
end

to decrement
	make "count :count - 1
	updateUI
end

to reset
	make "count 0
	updateUI
end

to toggleTheme
	make "isDark (1 - :isDark)
	updateUI
end

; Simulate actions
updateUI
increment
increment
toggleTheme
decrement
reset

Logo Language Guide

Logo is an educational programming language known for its turtle graphics and simple syntax, designed to teach programming concepts and computational thinking to children and beginners.

Primary Use Cases

  • ▸Educational programming for children
  • ▸Teaching mathematics and logic
  • ▸Turtle graphics for visual learning
  • ▸Introductory programming courses
  • ▸Developing problem-solving and algorithmic thinking

Notable Features

  • ▸Simple and readable syntax
  • ▸Turtle graphics for immediate visual feedback
  • ▸Support for recursion and procedures
  • ▸Interactive command-based environment
  • ▸Encourages exploration and experimentation

Origin & Creator

Developed in 1967 by Wally Feurzeig, Seymour Papert, and Cynthia Solomon at MIT.

Industrial Note

Logo’s turtle graphics made it a pioneering tool for teaching algorithmic thinking and computational concepts in classrooms worldwide.

More Logo Typing Exercises

Logo Draw SquareLogo Draw TriangleLogo Draw Circle ApproximationLogo SpiralLogo StarLogo Draw PolygonLogo Triangle PatternLogo Random WalkLogo Colorful Spiral

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher