Skip to content

Instantly share code, notes, and snippets.

@envp
Last active February 1, 2016 18:20
Show Gist options
  • Select an option

  • Save envp/e7350a01acfcf0c87707 to your computer and use it in GitHub Desktop.

Select an option

Save envp/e7350a01acfcf0c87707 to your computer and use it in GitHub Desktop.
state = 1
counter = 0
# Customary: "Here be evil"
# For a live version, see: https://repl.it/BiiG/1
loop do
puts [state, counter].inspect
case state
when 1
state = 2
counter += 1
next
when 2
state = 1
counter += 1
state = nil if counter > 3
else
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment