Kotlinlearncs.online LogoJava
Return to List

Solve: Say It Again

Created By: Geoffrey Challen
/ Version: 2026.8.0

Printing the same thing over and over is exactly the kind of tedious job that a loop is for.

Assuming a String variable named message and an Int variable named times have been declared and initialized, write a snippet of code—not a function—that prints message on its own line, times times. So if message were "Hi" and times were 3, you would print:

Hi
Hi
Hi

times will never be negative, but it may be 0, in which case you should print nothing at all. You can use any kind of loop you want, but don't modify message or times.

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/kotlin/say-it-again/[email protected]