1 |
<html> |
2 |
<head> |
3 |
<meta name="author" content="Christian Schoenebeck"> |
4 |
<title>in_range() function</title> |
5 |
<meta name="description" content="Checks whether a value is between two other values."> |
6 |
</head> |
7 |
<body> |
8 |
<h1>in_range()</h1> |
9 |
<p> |
10 |
This function takes 3 integer values as arguments and checks whether the |
11 |
1st integer value is in the range between the two integer values provided by the |
12 |
2nd and 3rd arguments. The valid range includes the values of the 2nd and |
13 |
3rd arguments. |
14 |
</p> |
15 |
|
16 |
<h3>Function Prototype</h3> |
17 |
<p/> |
18 |
<code lang="nksp"> |
19 |
in_range(??needle??,??low??,??high??) |
20 |
</code> |
21 |
|
22 |
<h3>Arguments</h3> |
23 |
<table> |
24 |
<tr> |
25 |
<th>Argument Name</th> <th>Data Type</th> <th>Description</th> |
26 |
</tr> |
27 |
<tr> |
28 |
<td><code>??needle??</code></td> |
29 |
<td>Integer Number</td> |
30 |
<td>The value that is going to be checked whether it is in range.<br> |
31 |
[required]</td> |
32 |
</tr> |
33 |
<tr> |
34 |
<td><code>??low??</code></td> |
35 |
<td>Integer Number</td> |
36 |
<td>The smallest value of the valid range (including this value).<br> |
37 |
[required]</td> |
38 |
</tr> |
39 |
<tr> |
40 |
<td><code>??high??</code></td> |
41 |
<td>Integer Number</td> |
42 |
<td>The highest value of the valid range (including this value).<br> |
43 |
[required]</td> |
44 |
</tr> |
45 |
</table> |
46 |
|
47 |
<h3>Return Value</h3> |
48 |
<table> |
49 |
<tr> |
50 |
<th>Description</th> <th>Data Type</th> |
51 |
</tr> |
52 |
<tr> |
53 |
<td>Returns true (1) in case the value is in the allowed range, false (0) otherwise.</td> |
54 |
<td>Integer Number</td> |
55 |
</tr> |
56 |
</table> |
57 |
|
58 |
<h3>Examples</h3> |
59 |
<p> |
60 |
The following example prints the result of some example argument |
61 |
values to the terminal as soon as the script is loaded. |
62 |
<p/> |
63 |
<code> |
64 |
on init |
65 |
message("in_range(1,4,9) = " & in_range(1,4,9)) |
66 |
message("in_range(5,4,9) = " & in_range(5,4,9)) |
67 |
message("in_range(9,4,9) = " & in_range(9,4,9)) |
68 |
message("in_range(10,4,9) = " & in_range(10,4,9)) |
69 |
end on |
70 |
</code> |
71 |
|
72 |
<h3>Availability</h3> |
73 |
<p>Since LinuxSampler 2.0.0.svn36.<p> |
74 |
|
75 |
</body> |
76 |
</html> |