Scripts
title: An easy while() loop example
author: VMM Team
date: 2006-09-01
description:
Learn how easy it is to play some notes using a while loop.
code
/* an easy while loop example */
// include the MIDI functions library.
#include "stdmidi.vmm"
proc main()
{
// declare variable i
// (i will act as a counter)
i;
// give i value 0
i = 0;
// while i is smaller than 10
while (i < 10)
{
// Play a note.
NoteOn(1,60,127);
sleep(500);
NoteOff(1,60);
sleep(100);
// i = i + 1;
// so if i reaches 10 in the above statement,
// this loop will exit.
i++;
}
}
// include the MIDI functions library.
#include "stdmidi.vmm"
proc main()
{
// declare variable i
// (i will act as a counter)
i;
// give i value 0
i = 0;
// while i is smaller than 10
while (i < 10)
{
// Play a note.
NoteOn(1,60,127);
sleep(500);
NoteOff(1,60);
sleep(100);
// i = i + 1;
// so if i reaches 10 in the above statement,
// this loop will exit.
i++;
}
}
There's no sound file available yet.