![]() println (A ) // this is the line that produces an error! If we would take our previous example, but instead of counting from 1 to 5, we now want to count down from 5 to 1, then our code would look like this: Stick with the rule that the compound operatorsĪre always placed behind the variable in a “for” loop.ĭid we just say “counting down”? Yes we did!Ī “for” loop can also count down, by using the “––” compound operator. Now you know why I am not a fan of using these compound operators – especially in the beginning they can be very confusing. This effectively means that we work with the “old” value of “A” in the code block, but once the code block has been completed, A will assume the new (increased) value. “A++” means: “ increase the value of A by 1 and return the old value of A“. You will have to keep in mind that the “A++” is one of those confusing Compound Operators as we have seen in Part 3. The next thing you will see is that we create an accolade enclosed code block – the same way we have seen it with the “if” statement.Īnything in that code block will be repeated as long as the conditions are being met for the “for” loop. ![]() ![]() Since we just called those parameters, we need to put round brackets around them, as we have seen with other functions that get parameters (like for example Serial. Or in other words: a data type than can be enumerated (counted in whole numbers and with fixed increments).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |