Switch
Switch values (booleans) represent on/off states in Rhyme. They’re perfect for toggles, flags, and any true/false logic in your app.
Creating Switch Values
// Using true/false
$is-logged-in = true
$debug-mode = false
// Using on/off
$notifications = on
$sound-effects = off
// Using yes/no
$agree-to-terms = yes
$show-tutorial = no
Using Switches in Conditionals
// Simple conditional with a switch
if $online :
.text "You are online"
:end
// Using the switch directly
if $notifications :
.sound "notification.mp3"
:end
// Checking false conditions
if not $debug-mode :
.hide ".debug-panel"
:end
Common Uses
- Feature toggles
- User preferences
- Conditional logic
- State management
More content coming soon…