Big Chemical Encyclopedia

Chemical substances, components, reactions, process design ...

Articles Figures Tables About

Do While ... Loop

The Do While...Loop is used when you don t know beforehand how many times the loop will need to be executed. The syntax is shown in Figure 14-13. [Pg.268]

Figure 14-14. Alternate form of Do While...Loop structure. Figure 14-14. Alternate form of Do While...Loop structure.
Often you use a loop structure to search through an array or collection of objects, looking for a certain value or property. Once you find a match, you don t need to cycle through the rest of the loops. You can exit from the loop using the Exit For (from a For...Next loop or For Each...Next loop) or Exit Do (from a Do While... loop). The Exit statement will normally be located within an If statement. For example. [Pg.269]

There are three types of Do loops Do..., Do... While, andDo... Until. Of these, the first is somewhat tricky, because it is unconstrained, i.e., it could go on forever, in which case you may have to stop it with Esc or Ctrl + Break. Below we only discuss the constrained Do loops. The Do...While loop has the syntax... [Pg.479]

For the implementation of loop constructs, the entry and exit control nodes are used, which are similar to merge and branch nodes. Figure 7 shows the graph structure of a while-do-loop, A do-while loop (where the body is always exe-... [Pg.31]

There are four looping statements in VBA (For...Next, Do While...Loop, Do...Loop While, For Each...Next). Only the first two of these are presented since the other two are repetitious (or can be confusing). [Pg.35]

In a WHILE construction, WHILE Q DO P- ENDWHILE, notice that Q can be assumed true when P is initiated and false when the WHILE loop is ended (if it ever is). Thus if it is true that whenever A and Q hold at the start of P, then A holds at the end of P, then it is also true that whenever A holds at the start of the WHILE loop, then at the end A holds and NOT Q is true. [Pg.180]

Note that this form of the Do While structure executes the loop at least once. [Pg.269]

Syntax The beginning of the loop is delineated by Do or Do Until condition or Do While condition. The end of the loop is delineated by Loop or Loop Until condition or Loop While condition. Condition must evaluate to True or False. [Pg.425]

Use for construct when the number of loop iterations is known beforehand. Likewise, use while construct when the number of loop iterations is not known beforehand. Cases include reading data from a file or from user input line by line until the end is encountered. Though this can be achieved by using a for loop with a conditional break statement, the while statement conveys the logic clearly. Some special cases require using do-while (when the first statement has to be executed before the conditional). [Pg.43]

The syntax of the Do...Until loop is similar except that the term While is replaced by Until . In the above example, the Do Until statement would read Do Until c > N to yield the same result. As with For... Next loops, Do loops can be nested. [Pg.479]

LOOKUP (worksheet function) 82 Lookup Reference functions 81 lookup in table, with linear interpolation 171 Loop, Do While... (VBA) 268 loop, exiting from (VBA) 269 Loop, For Each...Next (VBA) 268 Loop, For...Next (VBA) 268 looping (VBA) 267 LOWER (worksheet function) 79... [Pg.499]

This script prints out the prompt Type something> and immediately enters a while loop. The while loop here is a little different from the ones shown before. Instead of doing a comparison, the while loop s test contains the expression defined ( line = <>). This expression looks a bit bizarre but can be explained very simply. The first thing that happens is that a line of input is read and assigned to the variable line. Then, line is then passed to a new function named defined, which returns true if the contents of a variable are defined, false otherwise. Recall that <> reads lines from a file (or keyboard) until it reaches the end of the file, at which point it returns undefined. This test is telling the while loop to read input lines one at a time imtil the end of the file is reached. The parentheses ensine that defined is called after the line is read into line, not before. [Pg.432]

A close relative of the while loop is C s do loop. It repeats a statement (or a group of statements) while a... [Pg.25]

C has two additional flow of control statements, break and continue, that augment the capabilities of the loops that have just been described. The break statement is used to break out of (to immediately terminate) the enclosing do, while, for, or switch statement. Its use is routine in switch statements, to terminate the switch statement at the conclusion of each individual case. In do, while, and for loops, break is often used to terminate the loop prematurely when an error or special condition occurs. Using a break in the body of a loop often simplifies the control expression of the loop, because it allows special case code to be placed elsewhere. [Pg.25]

Rem inizia il loop principale Do While Range ( b 14 ) < Range d 10 )... [Pg.375]

Number of Loops and Statements counts the number of loops (for, while, do-while) and statements (if, switch) in a program s source code... [Pg.1302]

Monomer conversion can be adjusted by manipulating the feed rate of initiator or catalyst. If on-line M WD is available, initiator flow rate or reactor temperature can be used to adjust MW [38]. In emulsion polymerization, initiator feed rate can be used to control monomer conversion, while bypassing part of the water and monomer around the first reactor in a train can be used to control PSD [39,40]. Direct control of surfactant feed rate, based on surface tension measurements also can be used. Polymer quality and end-use property control are hampered, as in batch polymerization, by infrequent, off-line measurements. In addition, on-line measurements may be severely delayed due to the constraints of the process flowsheet. For example, even if on-line viscometry (via melt index) is available every 1 to 5 minutes, the viscometer may be situated at the outlet of an extruder downstream of the polymerization reactor. The transportation delay between the reactor where the MW develops, and the viscometer where the MW is measured (or inferred) may be several hours. Thus, even with frequent sampling, the data is old. There are two approaches possible in this case. One is to do open-loop, steady-state control. In this approach, the measurement is compared to the desired output when the system is believed to be at steady state. A manual correction to the process is then made, based on the error. The corrected inputs are maintained until the process reaches a new steady state, at which time the process is repeated. This approach is especially valid if the dominant dynamics of the process are substantially faster than the sampling interval. Another approach is to connect the output to the appropriate process input(s) in a closed-loop scheme. In this case, the loop must be substantially detuned to compensate for the large measurement delay. The addition of a dead time compensator can... [Pg.183]

DO-UNTIL Loops. A DO-UNTIL loop is very similar to a while-wend loop. The syntax is... [Pg.83]

The major difference between a do-until loop and a while-wend loop is that in the DO-UNTIL loop the statements between the do and the until are executed at least once, whereas in the while-wend loop the loop will exit immediately at wend if E cpr is false. An example of a do-until loop is... [Pg.83]


See other pages where Do While ... Loop is mentioned: [Pg.268]    [Pg.268]    [Pg.8]    [Pg.479]    [Pg.268]    [Pg.26]    [Pg.268]    [Pg.268]    [Pg.8]    [Pg.479]    [Pg.268]    [Pg.26]    [Pg.402]    [Pg.402]    [Pg.26]    [Pg.440]    [Pg.440]    [Pg.25]    [Pg.865]    [Pg.417]    [Pg.423]    [Pg.429]    [Pg.479]    [Pg.487]    [Pg.744]    [Pg.26]    [Pg.30]   
See also in sourсe #XX -- [ Pg.268 ]




SEARCH



Do loop

While

While-loop

© 2024 chempedia.info