Write the function repeatString that takes a String and an integer, and returns a String built by repeating the given String given number of times.
For example, one should be able to call
print(repeatString("*", 10));and get
**********
as the output.
You can add to Strings together by:
String a = "Hello, ";
String b = "Alina";
print(a + b); // It'll print out "Hello, Alina"Use the printString function you wrote along with a for loop to print out this 6x6 triangle:
*
**
***
****
*****
******
Use the printString function you wrote along with a for loop to print out this triangle:
*******
*****
***
*
Im confused, why isnt
star + 1equivalent tostar ++? Also i didnt know what you meant by your comment "Yeah because the “star” variable never changes. You can increment a variable by writhing “star = star + 1” So i did my own workaround and apparently it worked when I used ++