logo CodeStepByStep logo


Language/Type: VB recursion

Write a recursive function named RepeatString that accepts a string and an integer n as parameters and that returns the string concatenated n times. For example, the call of RepeatString("hello", 3) returns "hellohellohello". Do not use any loops you must use recursion.

Constraints: Your function should throw an ArgumentException if passed any negative value for n. You are not allowed to construct any structured objects other than strings (no List, etc.) and you may not use any loops to solve this problem; you must use recursion.

Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.