© Radek Vystavěl 2017

Radek Vystavěl, C# Programming for Absolute Beginners, https://doi.org/10.1007/978-1-4842-3318-4_21

21. Improving Loops

Radek Vystavěl

(1)Ondřjov, Czech Republic

As you’ve learned, loops are mighty, and they are not trivial. That is why all the remaining chapters of the book are dedicated to understanding loops better. Let’s proceed to some more difficult exercises.

Choosing Text

First, you will return to the exercise with text repetition from the previous chapter and improve on it.

Task

In the section “Choosing the Number of Repetitions,” the user was allowed to vary the number of repetitions of a given sentence. Now you will allow the user to vary the sentence itself (see Figure 21-1).

Figure 21-1 Varying a sentence

Solution ...

Get C# Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.