rsc3/doc-schelp/Help-3.12.2/Reference/loop.html

52 lines
No EOL
3.4 KiB
HTML

<!doctype html><html lang='en'><head><title>loop / repeat | SuperCollider 3.9.3 Help</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script>
var helpRoot = './..';
var scdoc_title = 'loop / repeat';
var scdoc_sc_version = '3.9.3';
</script>
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
</head>
<body onload='fixTOC();prettyPrint()'>
<div id='toc'>
<div id='toctitle'>loop / repeat:</div>
<span class='toc_search'>Filter: <input id='toc_search'></span><ul class='toc'><li class='toc3'><a href='#.loop'>loop</a> <a href='#.repeat'>repeat</a> </li>
</ul></div><div class='contents'>
<div id='menubar'></div>
<div class='header'>
<div id='label'>
<span id='folder'>Reference</span>
| <span id='categories'><a href='./../Browse.html#Core'>Core</a> | <a href='./../Browse.html#Common methods'>Common methods</a></span>
</div><h1>loop / repeat</h1>
<div id='summary'>Repeat stuff</div>
</div>
<div class='subheader'>
</div>
<h3 class='method-code'><span class='method-prefix'></span><a class='method-name' name='loop' href='./../Overviews/Methods.html#loop'>loop</a></h3>
<h3 class='method-code'><span class='method-prefix'></span><a class='method-name' name='repeat' href='./../Overviews/Methods.html#repeat'>repeat</a></h3>
<div class='method'>
<p>Create an object that behaves like a stream that returns values for a limited (or infinite) number of times.
<p>For a full list of implementing classes, see <a href="./../Overviews/Methods.html#loop">Methods: loop</a> and <a href="./../Overviews/Methods.html#repeat">Methods: repeat</a><dl>
<dt><a href="./../Classes/Function.html#-loop">Function: -loop</a><dd>repeats the function forever.<pre class='code prettyprint lang-sc'> f = { 3.yield };
x = Routine({ f.loop });
10.do({ x.next.postln })</pre>
<dt><a href="./../Classes/Object.html#-repeat">Object: -repeat</a> (n)<dd>repeat to yield the object<pre class='code prettyprint lang-sc'> x = 5;
y = x.repeat(6);
y.nextN(8);</pre>
<dt><a href="./../Classes/Pattern.html#-repeat">Pattern: -repeat</a> (n)<dd><pre class='code prettyprint lang-sc'> x = Prand([1, 2]).repeat(6).asStream;
x.nextN(8);</pre>
<dt><a href="./../Classes/Pattern.html#-loop">Pattern: -loop</a><dd><pre class='code prettyprint lang-sc'> x = Prand([1, 2]).loop.asStream;
x.nextN(8);</pre>
<dt><a href="./../Classes/Stream.html#-repeat">Stream: -repeat</a> (n)<dd>embeds the stream repeatedly<pre class='code prettyprint lang-sc'> x = Routine({ 3.do({ arg i; i.yield }) }).repeat(6);
x.nextN(8);</pre>
<dt><a href="./../Classes/Stream.html#-loop">Stream: -loop</a><dd>embeds the stream repeatedly<pre class='code prettyprint lang-sc'> x = Routine({ 3.do({ arg i; i.yield }) }).loop;
x.nextN(8);</pre>
</dl>
<p></div><div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Reference/loop.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Reference/loop.schelp</a><br>link::Reference/loop::<br></div></div></body></html>