logo CodeStepByStep logo

Repeat

Language/Type: VB List collections

Write a function named Repeat that accepts a List of strings and an integer k as parameters and that replaces each element with k copies of that element. For example, if the list stores the values ("how", "are", "you?") before the function is called and k is 4, it should store the values ("how", "how", "how", "how", "are", "are", "are", "are", "you?", "you?", "you?", "you?") after the function finishes executing. If k is 0 or negative, the list should be empty after the call.

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.