Created
August 4, 2009 23:22
-
-
Save judofyr/162368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Taken from The Ruby Programming Language, page 110. | |
# The following simple Ruby program demostrates a flip-flop. It reads a | |
# text file line-by-line and prints any lines that contains the text "TODO". | |
# It then continues printing lines until it reads a blank line. | |
ARGF.each do |line | # For each line of standard in or of named files | |
print line if line=~/TODO/..line=~/^$/ # Print lines when flip-flop is true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment