1. Home
  2. /
  3. Snap
  4. /
  5. Snap! Variable Toggle

Snap! Variable Toggle - Snap Typing CST Test

Loading…

Snap! Variable Toggle — Snap Code

Uses space key to toggle a boolean variable.

when green flag clicked
	set [active v] to [false]
	forever
		if <key [space] pressed?> then
		if <(active) = [false]> then
		set [active v] to [true]
		else
		set [active v] to [false]
		end
		wait (0.2) secs
		end
	end

Snap Language Guide

Snap! is a visual, block-based programming language based on Scratch, designed for advanced CS education. It enables functional programming, first-class procedures, lists, recursion, and custom blocks through a drag-and-drop interface.

Primary Use Cases

  • ▸Teaching computer science concepts
  • ▸Block-based curriculum for beginners
  • ▸Functional programming demonstrations
  • ▸Higher-order functions in visual form
  • ▸Rapid prototyping using visual logic

Notable Features

  • ▸Block-based visual programming
  • ▸Higher-order functions
  • ▸Custom block creation
  • ▸First-class lists and procedures
  • ▸Browser-based, installation-free

Origin & Creator

Snap! (originally BYOB - Build Your Own Blocks) was created by Jens Mönig and Brian Harvey at UC Berkeley.

Industrial Note

Snap! is used in CS education research, AP CS Principles courses, outreach programs, and early-stage prototyping of logic without syntax.

More Snap Typing Exercises

Simple Snap! ProjectSnap! Hello WorldSnap! CounterSnap! Bounce on EdgeSnap! Random Color ChangerSnap! Keyboard Controlled RotationSnap! Sprite Glide DemoSnap! Animation FramesSnap! Simple Sound Player

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher