An example WEB program

An example of Knuth's WEB, for https://tex.stackexchange.com/a/502817:

To illustrate WEB a bit better, here is a rather elaborate version of the hello-world program that uses most of the main features of WEB: named and unnamed sections; simple, numeric, and parametric macros; some formatting and indexing controls; and, most exotic of all, the string pool.

All that the program does is print “Hello world” N times after reading a number N (so there's nothing mathematically or algorithmically non-trivial to add difficulty, unlike the GLUE or PRIMES programs), but it is split up into modules, and uses double-quoted strings that (TANGLE writes and) the program reads from the string pool file, maintaining the strings in an array of characters as TeX and other Knuth programs do.

The files: