Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial88 Extra Returns and Indents for Code Blocks
The following is syntactically correct but gains nothing:
var NeedsTimingInfo = true;
var activeNotes = [];
var lastBlockStart;
function HandleMIDI( event ) {
if ( event instanceof NoteOn ) {
activeNotes.push( event );
} else if ( event instanceof NoteOff ) {
// remove the note from activeNotes
}}
function ProcessMIDI() {
var timingInfo = GetTimingInfo();
if ( timingInfo.playing ) {
var currBlockStart = Math.floor(timingInfo.blockStartBeat);
if ( currBlockStart != lastBlockStart \&\&
( currBlockStart <= 1 || currBlockStart \% timingInfo.meterNumerator == 0 ) ) {
Trace(lastBlockStart + " - " + currBlockStart)
}}}What may seem like a benefit in having everything viewable in a single window pane will be much harder to maintain when returned to days or even weeks later.