Okay, so you wrote a nice melody. What if you want to repeat it, or parts of it, a few times. You could copy and paste the melody but that gets a bit tiring after a while. Luckily you can use repetition! The fancy computer science term for this is iteration which just means doing things more than once.
2.times do to the beginning of your melody and
end to the end of your melody (the notes are in musical notation just for example, you can use MIDI notes if you wish):
Instead of using
2.times do you can choose how many times you want to repeat the notes. For example
4.times do or
You can also use repetitions inside repetitions if you wish: