2 ms·
A pretty good article. Events aren't a bad metaphor, but it's actually simpler than that. The whole program, except BEGIN and END blocks, is a big loop. Blocks
by mtdewcmu 13y ago
A pretty good article. Events aren't a bad metaphor, but it's actually simpler than that. The whole program, except BEGIN and END blocks, is a big loop. Blocks with conditions in front are just if statements without having to type if. They're executed one after the other, and they can affect each other by setting variables. If it encounters a next statement, no further commands are executed and it starts over on the next line. The beauty of it is that it saves you from having to set up the loop and write I/O commands to loop through a text file.
- gingerlime 13y agoThe event / pattern-matching analogy was pretty great for me. I never really bothered much with awk, possibly out of sheer laziness, but with this small piece of knowledge, it somehow feels much more accessible and logical to use. That said, the loop concept and using next is also very valuable piece of information. So thanks to both!