The above snippet takes a number afterward to select the size. In the case of nothing given, $n gets a value of 0. The q{*} x $n will give nothing if $n is 0, or $n asterisks. The if statement prevents the loop for the sides and printing a bottom if $n is 1. The loop is triggered only if $n - 1 is greater than 2 (ie, 3 or more), and prints only the asteristks on either edge, producing the "hole" in the middle.
Hope that helps.
In reply to Re^3: Printing a hollow square of Asterisks
by atcroft
in thread Printing a hollow square of Asterisks
by Rafter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |