aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/help-until.pd
blob: 8faa4e3afb18d2ebcf610ad0e009fddcd3597fdd (plain)
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
#N canvas 59 5 829 645 10;
#X msg 28 525 bang;
#X obj 25 13 until;
#X obj 28 546 until;
#X text 59 525 start;
#X obj 28 568 f;
#X obj 57 568 + 1;
#X obj 103 570 sel 0;
#X obj 28 612 print;
#X obj 57 590 mod 10;
#X text 19 42 Every modern programming language will have various "looping"
mechanisms: either in the form of an object \, or as a data structure.
For example in Visual Basic:;
#X text 30 100 DO UNTIL i = 100;
#X text 30 114 i = i + 1;
#X text 31 85 i = 0;
#X text 30 129 LOOP;
#X text 15 210 And now PD's version of the above programming structures:
;
#X obj 24 257 until;
#X msg 24 237 100;
#X obj 24 277 print i;
#X text 17 304 If you start [until] with a "bang" \, it will begin
an infinite loop! Please plan ahead in this case so that there is a
mechanism in place to stop the loop - otherwise PD will effectively
freeze.;
#X text 17 361 HOW TO FREEZE PD;
#X msg 25 384 bang;
#X obj 25 404 until;
#X obj 25 424 print;
#X text 63 384 DO NOT CLICK. DO NOT CLICK. DO NOT CLICK.;
#X text 66 404 If you click \, click the "close window" (X) button
on PD's terminal window - or reboot the computer.;
#X text 17 145 OR:;
#X text 29 161 FOR i = 0 TO 100;
#X text 28 187 NEXT;
#X text 29 175 ' do something;
#X text 26 493 The example below includes a method to stop the loop
to prevent PD from looping infinitely.;
#X text 434 44 If you start [until] with a number \, it iterates that
number of times. The [uzi] object in MAX works the same way.;
#X obj 441 131 until;
#X msg 441 84 100;
#X obj 441 151 print i;
#X msg 469 91 3;
#X msg 497 98 42;
#X text 26 451 The [until] object's left inlet starts a loop in which
it outputs "bang" until its right inlet gets a "bang" which stops it.
;
#X obj 413 17 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 413 605 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 67 13 - LOOPing mechanism;
#X text 442 580 This document was updated for PD version 0.35 test
26 by Dave Sabine as part of a project called pddp proposed by Krzysztof
Czaja to build comprehensive documentation for PD.;
#X text 436 185 RELATED OBJECTS;
#X text 441 204 ?? This author does not know of any other native looping
mechanisms in PD.;
#N canvas 0 0 452 302 related_objects_from_other_libraries 0;
#X text 27 63 These objects are offered in PD only if you have downloaded
and properly installed the appropriate library. These objects may or
may not exist in a single library.;
#X text 26 112 The best places to find information about PD's libraries
is:;
#X text 23 134 www.puredata.org and click on "Downloads" then "Software"
;
#X text 25 149 or;
#X text 25 164 iem.kug.ac.at/pdb/;
#X obj 43 32 for++;
#X obj 90 32 counter;
#X obj 150 32 gem_counter;
#X obj 250 32 modulo_counter;
#X restore 449 244 pd related_objects_from_other_libraries;
#X connect 0 0 2 0;
#X connect 2 0 4 0;
#X connect 4 0 5 0;
#X connect 4 0 7 0;
#X connect 5 0 8 0;
#X connect 6 0 2 1;
#X connect 8 0 4 1;
#X connect 8 0 6 0;
#X connect 15 0 17 0;
#X connect 16 0 15 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 31 0 33 0;
#X connect 32 0 31 0;
#X connect 34 0 31 0;
#X connect 35 0 31 0;
#X connect 37 0 38 0;