For patterns, starting at 1 often makes the mathematical formulas much easier to read and derive, though starting at 0 is technically standard for array access.
Understanding Row and Column Relationships in Patterns
Is it better to start the row counter at 0 or 1?
The answer
More FAQs in Understanding Row and Column Relationships in Patterns
It always consists of an outer loop tracking the rows, one or more inner loops tracking columns/spaces, and a newline command at the end of the outer loop.
Create a table on paper. Write down the row number on the left, and the number of stars on the right. Look for a linear equation (y = mx + b) that connects them.
You are likely using a print-line command (like println) inside the inner loop, forcing every single star onto a new line instead of keeping them on the same row.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.