I'm trying to make an algorithm to print a triangle of asterisks. For some reason, it sets the output asterisk as only one every time, instead of (maxShapeWidth - i) asterisks. Any help is appreciated.
Also, ignore the title. I'm not sure what exactly is causing the problem, and I didn't want to say something about a triangle algorithm.
Although they have the same names, the strings at lines 13 and 15 are different. The one at line 15 gets destroyed at line 16. So try replacing line 15 with stars = string(maxShapeWidth - i, '*')