File: node15.html

package info (click to toggle)
mma 0.12-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,020 kB
  • ctags: 1,143
  • sloc: python: 5,235; makefile: 37
file content (768 lines) | stat: -rw-r--r-- 21,125 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.70)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Variables, Conditionals and Jumps</TITLE>
<META NAME="description" CONTENT="Variables, Conditionals and Jumps">
<META NAME="keywords" CONTENT="mma">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="mma.css">

<LINK REL="next" HREF="node16.html">
<LINK REL="previous" HREF="node14.html">
<LINK REL="up" HREF="mma.html">
<LINK REL="next" HREF="node16.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html491"
  HREF="node16.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="file:/usr/lib/latex2html/icons/next.png"></A> 
<A NAME="tex2html489"
  HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="file:/usr/lib/latex2html/icons/up.png"></A> 
<A NAME="tex2html483"
  HREF="node14.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="file:/usr/lib/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html492"
  HREF="node16.html">Low Level MIDI Commands</A>
<B> Up:</B> <A NAME="tex2html490"
  HREF="mma.html">Reference Manaul</A>
<B> Previous:</B> <A NAME="tex2html484"
  HREF="node14.html">Repeats</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html493"
  HREF="node15.html#SECTION001510000000000000000">Variables</A>
<UL>
<LI><A NAME="tex2html494"
  HREF="node15.html#SECTION001511000000000000000">Set [string]</A>
<LI><A NAME="tex2html495"
  HREF="node15.html#SECTION001512000000000000000">Mset [lines] MsetEnd/EndMset</A>
<LI><A NAME="tex2html496"
  HREF="node15.html#SECTION001513000000000000000">UnSet VariableName</A>
<LI><A NAME="tex2html497"
  HREF="node15.html#SECTION001514000000000000000">ShowVars</A>
<LI><A NAME="tex2html498"
  HREF="node15.html#SECTION001515000000000000000">Inc and Dec</A>
<LI><A NAME="tex2html499"
  HREF="node15.html#SECTION001516000000000000000">VExpand On or Off</A>
</UL>
<BR>
<LI><A NAME="tex2html500"
  HREF="node15.html#SECTION001520000000000000000">Predefined Variables</A>
<LI><A NAME="tex2html501"
  HREF="node15.html#SECTION001530000000000000000">Conditionals</A>
<LI><A NAME="tex2html502"
  HREF="node15.html#SECTION001540000000000000000">Goto</A>
</UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION001500000000000000000"></A>
<A NAME="sec-variables"></A>
<BR>
Variables, Conditionals and Jumps
</H1>

<P>
To make the processing of your music easier, <I><B>MMA</B></I> supports a very primitive set for variable manipulations along with some conditional testing and the oft-frowned-upon <I>goto</I> command.

<P>

<H1><A NAME="SECTION001510000000000000000">
Variables</A>
</H1>

<P>
<I><B>MMA</B></I> lets you set a variable, much like in other programming languages and to do some basic manipulations on them. Variables are most likely to be used for two reasons:

<P>

<UL>
<LI>For use in setting up conditional segments of your file,

<P>
</LI>
<LI>As a shortcut to entering complex chord sequences.

<P>
</LI>
</UL>

<P>
To begin, the following list shows the available commands to set and manipulate variables:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set VariableName <I>String</I> 
<BR>
Mset VariableName ... MsetEnd 
<BR>
UnSet VariableName 
<BR>
ShowVars 
<BR>
Inc Variablename [value] 
<BR>
Dec Variablename [value] 
<BR>
Vexpand ON/Off   </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
All variable names are case-insensitive. Any characters can be used in a variable name. The only exceptions are that a variable name cannot start with a ``$'' or a ``_'' (an underscore--this is reserved for internal variables, see below).

<P>
Variables are set and manipulated by using their names. Variables are expanded when their name is prefaced by a space followed by single ``$'' sign. For example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set Silly Am / Bm / 
<BR>
1 $Silly  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The first line creates the variable ``Silly''; the second creates a bar of music with the chords ``Am / Bm /''.

<P>
Note that the ``$'' must be the first item on a line or follow a space character. For example, the following will NOT work:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set Silly 4a;b;c;d; 
<BR>
1  Am  {$Silly}  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
However:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>1 Am { $Silly}  </B></BLOCKQUOTE>

	</TD></TR></TABLE>  

<P>
will work fine.

<P>
Following are details on all the available variable commands:

<P>

<H2><A NAME="SECTION001511000000000000000">
Set [string]</A>
</H2> 

<P>
Set or create a variable. You can skip the <I>String</I> if you do want to assign an empty string to the variable. A valid example is:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set PassCount 1 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>

<H2><A NAME="SECTION001512000000000000000"></A>
	   
	<A NAME="sec-mset"></A>
<BR>
Mset [lines] MsetEnd/EndMset
</H2>

<P>
This command is quite similar to <I>Set</I>, but <I>Mset</I> expects multiple 	lines. An example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>MSet LongVar 
<BR>
1 Cm 
<BR>
2 Gm 
<BR>
3 G7 
<BR>
MsetEnd  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
It is quite possible to set a variable to hold an entire section of music (perhaps a chorus) and insert this via macro expansion at various places in your file.			   

<P>
Each <I>Mset</I> must be terminated by a <I>EndMset</I> or <I>MsetEnd</I> 	command (on its own separate line).

<P>

<H2><A NAME="SECTION001513000000000000000">
UnSet VariableName</A>
</H2> 	

<P>
Removes the variable. This can be useful if you have conditional tests which simply rely on a certain variable being ``defined''.

<P>

<H2><A NAME="SECTION001514000000000000000">
ShowVars</A>
</H2> 

<P>
Displays the names of the defined variables and their contents. Mainly used for debugging. The display will preface each variable name with a ``$''. Note that internal <I><B>MMA</B></I> variable are also displayed with this command.

<P>

<H2><A NAME="SECTION001515000000000000000">
Inc and Dec</A>
</H2>  

<P>
These commands increment or decrement a variable. If no argument is given, a value of 1 is used; otherwise, the value specified is used. The value can be an integer or a floating point number. 

<P>
A short example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set PassCount 1 
<BR>
Set Foobar 4 
<BR>
Showvars 
<BR>
Inc FooBar 4 
<BR>
Inc PassCount 
<BR>
ShowVars  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
This command is quite useful for creating conditional tests for proper handling of codas or groove changes in repeats.

<P>

<H2><A NAME="SECTION001516000000000000000">
VExpand On or Off</A>
</H2>

<P>
Normally variable expansion is enabled. These two options will turn expansion on or off. Why would you want to do this? Well, here's a simple example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set LeftC Am Em 
<BR>
Set RightC G / 
<BR>
VExpand Off 
<BR>
Set Full $LeftC $RightC 
<BR>
VExpand  On  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
In this case the actual contents of the variable ``Full'' is ``$LeftC $RightC''. If the <I>Off/On</I> option lines had not been used, the contents would be  ``Am Em G /''. You can easily verify this with the <I>ShowVars</I> 	option. 

<P>
When <I><B>MMA</B></I> processes a file it expands variables in a recursive manner. This means that, in the above example, the line:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>1 $Full </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will be changed to:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>1 Am Em G / </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
However, if later in the file, you change the definition of one of the 	variables ...for example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set LeftC Am / </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
the same line will now be ``1 Am / G /''.

<P>
Most of <I><B>MMA</B></I>'s internal commands <I>can</I> be redefined with variables. However, we really don't think you should use this feature. It's been left for two reasons: it might be useful, and, it's hard to disable.

<P>
However, not all commands can be redefined. The following is short list of things which will work (but, again, we're not suggesting you do this):

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set Rate Tempo 120 
<BR>		$Rate 
<BR>
Set  R Repeat 
<BR>		$R  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
But, the following will <I>not</I> work:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set B Begin 
<BR>
Set  E End 
<BR>		$B Arpeggio Define 
<BR>		.... 
<BR>		$E  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
This fails since the Begin/End constructs are expanded before variable expansion. However:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set A Define Arpeggio 
<BR>
Begin $a
		...
		End  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
is quite alright.

<P>
Even though you can use a variable to substitute for the <I>Repeat</I> or <I>If</I> directives, using one for <I>RepeatEnd/EndRepeat</I>, <I>RepeatEnding</I>. <I>Label</I> or <I>IfEnd/EndIf</I> will fail.

<P>
Variable expansion should usually not be a concern. In most normal files, <I><B>MMA</B></I> will expand variables as they are encountered. However, when reading the data in a <I>Repeat</I>, <I>If</I> or <I>Mset</I> section the expansion function is skipped--but, when the lines are processed, after being stored in an internal queue, variables are expanded. 

<P>

<H1><A NAME="SECTION001520000000000000000">
Predefined Variables</A>
</H1>

<P>
For your convenience <I><B>MMA</B></I> tracks a number of internal settings and saves their values in variables you can access just like you would a user defined variable. All of these ``internal'' variables are prefaced with a single underscore. For example, the current tempo is saved in the variable <I>_TEMPO</I>; this can be accessed in your script with the notation <I>$_TEMPO</I>.

<P>
<DL>
<DT><STRONG>_Groove</STRONG></DT>
<DD>Name of the currently selected groove. May be empty if no groove has been selected.

<P>
</DD>
<DT><STRONG>_LastGroove</STRONG></DT>
<DD>Name of the groove selected <I>before</I> the currently selected groove. 

<P>
</DD>
<DT><STRONG>_SeqSize</STRONG></DT>
<DD>Current <I>SeqSize</I> setting.

<P>
</DD>
<DT><STRONG>_Tempo</STRONG></DT>
<DD>Current <I>Tempo</I>. Note that if you have used the optional <I>bar count</I> in setting the tempo this will be the target tempo.

<P>
</DD>
<DT><STRONG>_Time</STRONG></DT>
<DD>The current <I>Time</I> (beats per bar) setting.

<P>
</DD>
<DT><STRONG>_Transpose</STRONG></DT>
<DD>Current <I>Transpose</I> setting.

<P>
</DD>
<DT><STRONG>_Volume</STRONG></DT>
<DD>Current global volume setting.

<P>
</DD>
<DT><STRONG>_LastVolume</STRONG></DT>
<DD>Previously set global volume setting.

<P>
</DD>
<DT><STRONG>_Debug</STRONG></DT>
<DD>Current debug settings.

<P>
</DD>
<DT><STRONG>_LastDebug</STRONG></DT>
<DD>Debug settings prior to last <I>Debug</I> command. This setting can be used to restore settings, ie:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Debug Warnings=off 
<BR>		   ... stuff generating annoying warnings
<BR>
Debug $_LastDebug  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
</DD>
</DL>

<P>

<H1><A NAME="SECTION001530000000000000000">
Conditionals</A>
</H1>   

<P>
The most important reason we created variables in <I><B>MMA</B></I> was to use them in conditionals. In <I><B>MMA</B></I> a conditional consists of a line starting with an <I>If</I> directive, a test, a series of lines to process (depending upon the result of the test), and a closing <I>EndIf</I> or <I>IfEnd</I><A NAME="tex2html58"
  HREF="#foot5094"><SUP>15.1</SUP></A>  directive. An optional <I>Else</I> statement may be included.

<P>
The first set of tests are unary (they take no arguments):

<P>
<DL>
<DT><STRONG>Def VariableName</STRONG></DT>
<DD>Returns true if the variable has been defined.

<P>
</DD>
<DT><STRONG>Ndef VariableName</STRONG></DT>
<DD>Returns true if the variable has not been defined.

<P>
</DD>
</DL>

<P>
In the above tests you must supply the name of a variable--don't make the mistake of including a ``$'' which will invoke expansion and result in something you were not expecting.

<P>
A simple example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If Def InCoda 
<BR>		&nbsp;&nbsp;5 Cm 
<BR>		&nbsp;&nbsp;6 / 
<BR>
Endif </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The other tests are binary (they take two arguments):

<P>
<DL>
<DT><STRONG>LT Str1 Str2</STRONG></DT>
<DD>Returns true if <I>Str1</I> is less than <I>Str2</I>. (Please see the discussion below on how the tests are done.)

<P>
</DD>
<DT><STRONG>LE Str1 Str2</STRONG></DT>
<DD>Returns true if <I>str1</I> is less than or equal to <I>Str2</I>.

<P>
</DD>
<DT><STRONG>EQ Str1 Str2</STRONG></DT>
<DD>Returns true if <I>str1</I> is equal to <I>Str2</I>.

<P>
</DD>
<DT><STRONG>NE Str1 Str2</STRONG></DT>
<DD>Returns true if <I>str1</I> is not equal to <I>Str2</I>.

<P>
</DD>
<DT><STRONG>GT Str1 Str2</STRONG></DT>
<DD>Returns true if <I>str1</I> is greater than <I>Str2</I>.

<P>
</DD>
<DT><STRONG>GE Str1 Str2</STRONG></DT>
<DD>Returns true if <I>str1</I> is greater than or equal to <I>Str2</I>.

<P>
</DD>
</DL>

<P>
In the above tests you have several choices in specifying <I>Str1</I> and <I>Str2</I>. At some point, when <I><B>MMA</B></I> does the actual comparison, two strings or numeric values are expected. So, you really could do:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If EQ abc ABC </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
and get a ``true'' result. The reason that ``abc'' equals ``ABC'' is that all the comparisons in <I><B>MMA</B></I> are case-insensitive. 

<P>
You can also compare a variable to a string:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If GT $foo abc </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
will evaluate to ``true'' if the <I>contents</I> of the variable ``foo'' evaluates to something ``greater than'' ``abc''. But, there is a bit of a ``gotcha' here. If you have set ``foo'' to a two word string, then <I><B>MMA</B></I> will choke on the command. In the following example:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set Foo A B 
<BR>
If GT $Foo abc  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
the comparison is passed the line:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If GT A B abc </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
and <I><B>MMA</B></I> seeing three arguments generates an error. If you want the comparison done on a variable which might be more than one word, use the ``$$'' syntax. This delays the expansion of the variable until the <I>If</I> directive is entered. So:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If $$foo abc </B></BLOCKQUOTE>

	</TD></TR></TABLE>  

<P>
would generate a comparison between ``A B'' and ``ABC''.

<P>
Delayed expansion can be applied to either variable. It only works in an <I>If</I> directive.

<P>
Strings and numeric values can be confusing in comparisons. For example, if you have the strings ``22'' and ''3'' and compare them as strings, ``3'' is greater than ``22''; however, if you compare them as values then 3 is less than 22. 

<P>
The rule in <I><B>MMA</B></I> is quite simple: If either string in a comparison is a numeric value, both strings are converted to values. Otherwise they are compared as strings. <A NAME="tex2html59"
  HREF="#foot5123"><SUP>15.2</SUP></A>
<P>
This lets you do consistent comparisons in situations like:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Set Count 1 
<BR>
If LE $$Count 4 
<BR>		&nbsp;&nbsp;.... 
<BR>
IfEnd </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
Note that in the above example we could have used ``$Count'', but you should probably always use the ``$$'' in tests.

<P>
Much like other programming languages, an optional <I>Else</I> condition may be used:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If Def Coda 
<BR>		&nbsp;&nbsp;Groove Rhumba1 
<BR>
Else 
<BR>		&nbsp;&nbsp;Groove Rhumba 
<BR>
Endif  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The <I>Else</I> statement(s) are processed only if the test for the <I>If</I> test is false. 

<P>
Nesting of <I>If</I>s is permitted:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>If ndef Foo 
<BR>		&nbsp;&nbsp;Print Foo has been defined. 
<BR>
Else 
<BR>		&nbsp;&nbsp;If def bar 
<BR>		&nbsp;&nbsp;&nbsp;&nbsp;Print bar has been defined. Cool. 
<BR>		&nbsp;&nbsp;Else 
<BR>		&nbsp;&nbsp;&nbsp;&nbsp;Print no bar...go thristy. 
<BR>		&nbsp;&nbsp;Endif 
<BR>
Endif  </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
works just fine. We've used indentation in our examples to clearly show the nesting and conditions. We suggest you do the same.

<P>

<H1><A NAME="SECTION001540000000000000000">
Goto</A>
</H1> 

<P>
The <I>Goto</I> command redirects the execution order of you script to the point at which a <I>Label</I> has been defined. There are really two parts to this:

<P>

<OL>
<LI>A command defining a label, and,
</LI>
<LI>The <I>Goto</I> command.
</LI>
</OL>

<P>

<P>
A label is set with the <I>Label</I> directive:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Label Point1 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
The string defining the label can be any sequence of characters. Labels are case-insensitive. You can not set two points in your file to the same label.

<P>

<P>
To cause execution to jump to a labeled point:

<P>

	<TABLE CELLSPACING=0 CELLPADDING=5" BGCOLOR="OldLace" BORDER=3><TR> <TD>
<BLOCKQUOTE><B>Goto Point1 </B></BLOCKQUOTE>

	</TD></TR></TABLE> 

<P>
This causes an immediate jump. Any remaining lines in a repeat or conditional segment are discarded.

<P>
<I><B>MMA</B></I> does not check to see if you are jumping into a repeat or conditional section of code--but doing so will usually cause an error. Jumping out of these sections is usually safe.

<P>
For an example of how to use some simple labels to simulate a ``DS al Coda'' examine the file ``lullaby-of-Broadway'' in the sample songs directory.
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot5094">...IfEnd</A><A
 HREF="node15.html#tex2html58"><SUP>15.1</SUP></A></DT>
<DD>We probably suffer from mild dyslexia and can't remember if the command is IFEND or ENDIF, so both are permitted. Use whichever is more comfortable for you.

</DD>
<DT><A NAME="foot5123">... strings.</A><A
 HREF="node15.html#tex2html59"><SUP>15.2</SUP></A></DT>
<DD>An attempt is made to convert each string to a float. If conversion of both strings is successful, the comparison is made between two floats, otherwise two strings are used.

</DD>
</DL><HR>
<!--Navigation Panel-->
<A NAME="tex2html491"
  HREF="node16.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="file:/usr/lib/latex2html/icons/next.png"></A> 
<A NAME="tex2html489"
  HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="file:/usr/lib/latex2html/icons/up.png"></A> 
<A NAME="tex2html483"
  HREF="node14.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="file:/usr/lib/latex2html/icons/prev.png"></A>   
<BR>
<B> Next:</B> <A NAME="tex2html492"
  HREF="node16.html">Low Level MIDI Commands</A>
<B> Up:</B> <A NAME="tex2html490"
  HREF="mma.html">Reference Manaul</A>
<B> Previous:</B> <A NAME="tex2html484"
  HREF="node14.html">Repeats</A>
<!--End of Navigation Panel-->
<ADDRESS>
Bob
2004-12-02
</ADDRESS>
</BODY>
</HTML>