In this particular case the repetition is not so bad, but you can imagine that if you wanted to create a grid with thousands of rows and columns, this approach would make program-writing very tiring. Most people who look at this code immediately notice that it contains the same two lines repeated over and over. What it means is, "Take the value currently in the variable y, add 25 to it and place the result back into the variable y." So if y contains 10 before the line is executed, it will contain 35 immediately after the line is executed.) (For some new programmers, the statement "y = y + 25 " looks odd the first time they see it.
0 Comments
Leave a Reply. |