Debian Codegraph @

docs/manual/Formulas_7__Control_structures.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>Formulas 7. Control structures</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
12 Formulas 7. Control structures
13 </b></font></table></table>
14 <h2>if ... then ... else ... fi</h2>
15 <p>You can use conditional expressions in all formulas. For example, </p>
16 <code> 3 * if 52% * 3908 &gt; 2000 then 5 else 6 fi<br></code>
17 <p>evaluates to 15. Instead of <b><code><font size=+1>fi</font></code></b>, you can also use <b><code><font size=+1>endif</font></code></b>.</p>
18 <p>Another example: you can clip the absolute amplitude of a Sound to 0.5 by supplying the following formula:</p>
19 <code> if abs(self)&gt;0.5 then if self&gt;0 then 0.5 else -0.5 fi else self fi<br></code>
20 <h2>The semicolon</h2>
21 <p>The semicolon ends the evaluation of the formula. This can be convenient if you do not want to overwrite a long formula in your text field: the formula</p>
22 <code> 800;sqrt(2)*sin(2*pi*103*0.5)+10^(-40/20)*randomGauss(0,1)<br></code>
23 <p>evaluates to 800.</p>
24 <h3>Links to this page</h3>
25 <ul>
26 <li><a href="Formulas.html">Formulas</a>
27 </ul>
28 <hr>
29 <address>
30 <p>© ppgb 20031228</p>
31 </address>
32 </body>
33 </html>