2 ms·
The number of rows that you have will be your X offset (or in other words, the number of spaces that you start a line with) before you draw a repeating pattern
by Minor49er 4y ago
The number of rows that you have will be your X offset (or in other words, the number of spaces that you start a line with) before you draw a repeating pattern of stars. Each iteration, you subtract from the offset. Here's a simple example in PHP:
<?php
$maxStars = 5;
for ($stars=1; $stars <= $maxStars; $stars++) {
$offset = $maxStars - $stars;
echo str_repeat(' ', $offset);
for ($starCounter = 0; $starCounter < $stars-1; $starCounter++) {
echo '* ';
}
echo "*\n";
}