Animate the Hollow Square pattern and see how a single border condition selects exactly the right cells.
An n×n square where only the border cells contain stars. Interior cells are left empty (spaces).
For each cell (i, j) in the n×n grid, place a star if it lies on the first row, last row, first column, or last column.
Stars per border = 4*(n-1). Interior cells = (n-2)². The condition picks out every edge cell with a single if-statement.