# 052: Watching State
# React to state changes

state temperature = 72

# Watch for changes
watch temperature:
  show "Temperature is now {temperature}°F"

  if temperature > 80:
    show "It's hot!"
  else if temperature < 60:
    show "It's cold!"
  else:
    show "Temperature is comfortable"

# Modify state
button "Increase" -> increase_temp()
button "Decrease" -> decrease_temp()

increase_temp():
  temperature = temperature + 5

decrease_temp():
  temperature = temperature - 5

# Watcher runs automatically whenever temperature changes
