But imagine how many times youโd have to type the same line if you wanted to print it 100 times! Or imagine wanting to make a change to all of those lines, for example wanting two exclamation marks at the end of each output line. Here is a more elegant solution: a so-called loop:
C actually supports multiple types of loops. This one is called a for-loop; weโll learn about the other types of loops later. We will also soon learn more about the use of the rather mysterious-looking โiโ and the line โint i;โ. For now, just think of i as something that can hold different values. In this particular example, i takes on values between 1 and 5, and for each value of i between 1 and 5 this loop prints out Hello, World!. That is, Hello, World! is printed exactly 5-times.